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

Revert "Make RefreshCheckRunsJob and RefreshStatusesJob enqueue one of themselves per commit" #1343

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading