Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gitstart_bot committed Dec 30, 2024
1 parent 6742700 commit 8fca050
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/jobs/commit/continuous_backmerge_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def handle_retry(count, is_head_commit)
attempt = count + 1
Commit::ContinuousBackmergeJob
.set(wait: backoff_in(attempt:, period: :minutes, type: :linear, factor: 5))
.perform_later(commit.id, is_head_commit:, count: attempt)
.perform_async(commit.id, {"is_head_commit" => is_head_commit, "count" => attempt})
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/libs/coordinators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ module Coordinators
module Signals
def self.release_has_started!(release)
release.notify!("New release has commenced!", :release_started, release.notification_params)
Releases::PreReleaseJob.perform_later(release.id)
Releases::FetchCommitLogJob.perform_later(release.id)
RefreshReportsJob.perform_later(release.hotfixed_from.id) if release.hotfix?
Releases::PreReleaseJob.perform_async(release.id)
Releases::FetchCommitLogJob.perform_async(release.id)
RefreshReportsJob.perform_async(release.hotfixed_from.id) if release.hotfix?
end

def self.commits_have_landed!(release, head_commit, rest_commits)
Expand Down
2 changes: 1 addition & 1 deletion app/libs/coordinators/finish_platform_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ def call
attr_reader :release_platform_run
delegate :train, :with_lock, to: :release
delegate :release, :app, :last_commit, to: :release_platform_run
end
end
4 changes: 2 additions & 2 deletions app/libs/coordinators/process_commits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def fetch_commit_parents(commit)

def attempt_backmerge!(created_head_commit, created_rest_commits)
return unless created_head_commit
Commit::ContinuousBackmergeJob.perform_later(created_head_commit.id, is_head_commit: true)
created_rest_commits.each { |c| Commit::ContinuousBackmergeJob.perform_later(c.id, is_head_commit: false) }
Commit::ContinuousBackmergeJob.perform_async(created_head_commit.id, {"is_head_commit" => true})
created_rest_commits.each { |c| Commit::ContinuousBackmergeJob.perform_async(c.id, {"is_head_commit" => false}) }
end

delegate :train, to: :release
Expand Down
2 changes: 1 addition & 1 deletion app/libs/coordinators/start_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ def invalid_custom_version?
rescue ArgumentError
true
end
end
end
2 changes: 1 addition & 1 deletion app/models/commit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ def notification_params
}
)
end
end
end
2 changes: 1 addition & 1 deletion app/models/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,4 @@ def set_version
def set_internal_notes
self.internal_notes = DEFAULT_INTERNAL_NOTES.to_json
end
end
end
6 changes: 3 additions & 3 deletions spec/jobs/releases/copy_previous_approvals_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
it "adds approval items to the release if none exist" do
expect(release.approval_items).to be_empty

described_class.perform_now(release.id)
described_class.new.perform(release.id)
release.reload

expect(release.approval_items.size).to eq(1)
end

it "performs the job successfully without errors" do
expect { described_class.perform_now(release.id) }.not_to raise_error
expect { described_class.new.perform(release.id) }.not_to raise_error
end

context "when release is not found" do
it "logs an error if release is not found" do
erroneous_release_id = Faker::Number.number
allow(Rails.logger).to receive(:error)

described_class.perform_now(erroneous_release_id)
described_class.new.perform(erroneous_release_id)

expect(Rails.logger).to have_received(:error).with("Release with ID #{erroneous_release_id} not found")
end
Expand Down
4 changes: 2 additions & 2 deletions spec/libs/coordinators/process_commits_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@
release = create(:release, :created, :with_no_platform_runs, train:)
_release_platform_run = create(:release_platform_run, release_platform:, release:)
allow(Coordinators::CreateBetaRelease).to receive(:call)
allow(Commit::ContinuousBackmergeJob).to receive(:perform_later)
allow(Commit::ContinuousBackmergeJob).to receive(:perform_async)

described_class.call(release, head_commit_attributes, rest_commit_attributes)
commit = release.all_commits.last

expect(Commit::ContinuousBackmergeJob).to have_received(:perform_later).with(commit.id, is_head_commit: true)
expect(Commit::ContinuousBackmergeJob).to have_received(:perform_async).with(commit.id, {"is_head_commit" => true})
end

context "when build queue" do
Expand Down
8 changes: 4 additions & 4 deletions spec/models/release_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

describe "after_commit callback#Releases::CopyPreviousApprovalsJob" do
it "enqueues the CopyPreviousApprovalsJob after commit when copy_approvals_enabled? returns true" do
allow(Releases::CopyPreviousApprovalsJob).to receive(:perform_later)
allow(Releases::CopyPreviousApprovalsJob).to receive(:perform_async)
release.train.update(copy_approvals: true)
release.run_callbacks(:commit) { true }
expect(Releases::CopyPreviousApprovalsJob).to have_received(:perform_later).with(release.id)
expect(Releases::CopyPreviousApprovalsJob).to have_received(:perform_async).with(release.id)
end

it "does not enqueue the CopyPreviousApprovalsJob if copys_approvals_enabled? returns false" do
release.train.update(copy_approvals: false)
allow(Releases::CopyPreviousApprovalsJob).to receive(:perform_later)
allow(Releases::CopyPreviousApprovalsJob).to receive(:perform_async)

release.run_callbacks(:commit) { true }
expect(Releases::CopyPreviousApprovalsJob).not_to have_received(:perform_later)
expect(Releases::CopyPreviousApprovalsJob).not_to have_received(:perform_async)
end
end

Expand Down

0 comments on commit 8fca050

Please sign in to comment.