about summary refs log tree commit diff
path: root/app/services/remove_status_service.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-05-19 23:52:08 +0200
committerGitHub <noreply@github.com>2021-05-19 23:52:08 +0200
commit9a19227f177fb328378bd63d45c3683a00d4eda9 (patch)
treeb900d23f36957c92da5688761c5148591f7cddb3 /app/services/remove_status_service.rb
parent028ba13eb3f1e5e5e35485fe1531ec7630e84abe (diff)
Fix some RedisLocks auto-releasing too fast (#16276)
* Fix Delete and Create-related locks expiring too fast

Fixes #16238

By default, RedisLock expires after 10 seconds, which may not be enough to
process statuses, especially when those have attached media files.

This commit extends those 10 seconds to 15 minutes, which should be plenty
enough to handle any status, while being short enough to not waste many
sidekiq job retries in the exceedingly rare case in which a sidekiq process
would crash when processing a `Create` or `Delete`.

* Fix other RedisLock autorelease durations

Fixes #15645

- things that only perform a few simple database queries (e.g. finding and
  saving a record) have been left unchanged, so they'll still use the default
  10s duration
- things that perform significantly more complex database queries have been
  changed to a 5 minutes timeout
- things that perform multiple HTTP queries have been changed to a 15 minutes
  timeout
Diffstat (limited to 'app/services/remove_status_service.rb')
-rw-r--r--app/services/remove_status_service.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index 6e4d6e72a..b680c8e96 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -141,6 +141,6 @@ class RemoveStatusService < BaseService
   end
 
   def lock_options
-    { redis: Redis.current, key: "distribute:#{@status.id}" }
+    { redis: Redis.current, key: "distribute:#{@status.id}", autorelease: 5.minutes.seconds }
   end
 end