diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-23 16:48:08 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-23 16:48:08 -0500 |
commit | 3862f48c34a00691a12c6002abd88b088cf7c13e (patch) | |
tree | f1d5d2299de3d470816300221d3dba6ac8ecc30c /app/workers/scheduler | |
parent | 2a6ccce070277c8c278a2e8403f45394eec06f91 (diff) |
add self-destructing roars & `live`/`lifespan` bangtags
Diffstat (limited to 'app/workers/scheduler')
-rw-r--r-- | app/workers/scheduler/destructing_statuses_scheduler.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/workers/scheduler/destructing_statuses_scheduler.rb b/app/workers/scheduler/destructing_statuses_scheduler.rb new file mode 100644 index 000000000..d79f97c33 --- /dev/null +++ b/app/workers/scheduler/destructing_statuses_scheduler.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class Scheduler::DestructingStatusesScheduler + include Sidekiq::Worker + + sidekiq_options unique: :until_executed, retry: 0 + + def perform + due_statuses.find_each do |destructing_status| + DestructStatusWorker.perform_at(destructing_status.delete_after, destructing_status.id) + end + end + + private + + def due_statuses + DestructingStatus.where('delete_after <= ?', Time.now.utc + PostStatusService::MIN_DESTRUCT_OFFSET) + end +end |