mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not prevent other topic timers running on error (#13665)
There was an issue with the TopicTimerEnqueuer where any timer that failed to enqueue_typed_job with an error would prevent all other pending timers after the one that errored from running. To mitigate this we just capture the error and log it (so we can still fix it if needed for bug crushing) and proceed with the rest of the timer enqueues. The commit https://github.com/discourse/discourse/pull/13544 highlighted this issue originally in hosted sites. <!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
This commit is contained in:
@@ -47,4 +47,9 @@ RSpec.describe Jobs::TopicTimerEnqueuer do
|
||||
Jobs.enqueue_at(1.hours.from_now, :close_topic, topic_timer_id: timer1.id)
|
||||
subject.execute
|
||||
end
|
||||
|
||||
it "does not fail to enqueue other timers just because one timer errors" do
|
||||
TopicTimer.any_instance.stubs(:enqueue_typed_job).raises(StandardError).then.returns(true)
|
||||
expect { subject.execute }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user