Skip to content

Commit

Permalink
Revert "Make RefreshCheckRunsJob and RefreshStatusesJob enqueue one o…
Browse files Browse the repository at this point in the history
…f themselves per commit"
  • Loading branch information
kwboyd-shopify authored Apr 17, 2024
1 parent 98d1f3a commit 891d341
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 33 deletions.
4 changes: 1 addition & 3 deletions app/jobs/shipit/refresh_check_runs_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ def perform(params)
Commit.find(params[:commit_id]).refresh_check_runs!
else
stack = Stack.find(params[:stack_id])
stack.commits.order(id: :desc).limit(30).each do |commit|
RefreshCheckRunsJob.perform_later(commit_id: commit.id)
end
stack.commits.order(id: :desc).limit(30).each(&:refresh_check_runs!)
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions app/jobs/shipit/refresh_statuses_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ def perform(params)
Commit.find(params[:commit_id]).refresh_statuses!
else
stack = Stack.find(params[:stack_id])
stack.commits.order(id: :desc).limit(30).each do |commit|
RefreshStatusesJob.perform_later(commit_id: commit.id)
end
stack.commits.order(id: :desc).limit(30).each(&:refresh_statuses!)
end
end
end
Expand Down
23 changes: 0 additions & 23 deletions test/jobs/refresh_check_runs_job_test.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class RefreshStatusesJobTest < ActiveSupport::TestCase
@job = RefreshStatusesJob.new
end

test "#perform enqueues RefreshStatusesJob for the last 30 commits on the stack" do
assert_enqueued_jobs @stack.commits.count, only: RefreshStatusesJob do
@job.perform(stack_id: @stack.id)
end
test "#perform call #refresh_statuses! on the last 30 commits of the stack" do
Commit.any_instance.expects(:refresh_statuses!).times(@stack.commits.count)

@job.perform(stack_id: @stack.id)
end

test "if :commit_id param is present only this commit is refreshed" do
Expand Down

0 comments on commit 891d341

Please sign in to comment.