Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send active support notifications on run events #961

Merged
merged 11 commits into from
Feb 20, 2024
Prev Previous commit
Next Next commit
fix enqueued notifications
elfassy committed Feb 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 74acc6b45863805728c2138e13c90b7cb787a7e6
2 changes: 1 addition & 1 deletion app/models/maintenance_tasks/run.rb
Original file line number Diff line number Diff line change
@@ -455,7 +455,7 @@ def task
private

def instrument_status_change
return if status.nil? || !status_previously_changed?
return unless status_previously_changed? || id_previously_changed?
return if running? || pausing? || cancelling? || interrupted?

attr = {
6 changes: 6 additions & 0 deletions test/models/maintenance_tasks/run_test.rb
Original file line number Diff line number Diff line change
@@ -620,6 +620,12 @@ class RunTest < ActiveSupport::TestCase
end
end

test "#create defaults to the enqueued status" do
run = Run.create!(task_name: "Maintenance::CallbackTestTask")
assert_predicate(run, :enqueued?)
assert_equal(expected_notification(run), Notifier.payload.fetch("enqueued.maintenance_tasks"))
end

test "#task returns Task instance for Run" do
run = Run.new(task_name: "Maintenance::UpdatePostsTask")
assert_kind_of Maintenance::UpdatePostsTask, run.task