Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/archive_base.rb')
-rw-r--r--app/workers/archive_base.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/workers/archive_base.rb b/app/workers/archive_base.rb
index e1b641ae6..6b8b38a82 100644
--- a/app/workers/archive_base.rb
+++ b/app/workers/archive_base.rb
@@ -27,12 +27,17 @@ module Workers
end
def currently_running_archive_jobs
- return 0 if AppConfig.environment.single_process_mode?
-
Sidekiq::Workers.new.count do |process_id, thread_id, work|
!(Process.pid.to_s == process_id.split(":")[1] && Thread.current.object_id.to_s(36) == thread_id) &&
ArchiveBase.subclasses.map(&:to_s).include?(work["payload"]["class"])
end
+ rescue Redis::CannotConnectError
+ # If code gets to this point and there is no Redis conenction, we're
+ # running in a Test environment and have not mocked Sidekiq::Workers, so
+ # we're not testing the concurrency-limiting behavior.
+ # There is no way a production pod will run into this code, as diaspora*
+ # refuses to start without redis.
+ 0
end
end
end