Skip to content

Commit

Permalink
updated user update job
Browse files Browse the repository at this point in the history
  • Loading branch information
timalces committed Feb 15, 2024
1 parent 42df008 commit 3815107
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions app/jobs/user_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ class UserUpdateJob < ApplicationJob
retry_on ::Faraday::Error, wait: :polynomially_longer, attempts: RETRY_ATTEMPTS

def perform(user, changes, cloud_service_config, **options)
# If the user doesn't have any cloud or billing IDs there is no need to involve the middleware.
if user.cloud_user_id.nil? && user.billing_acct_id.nil?
return
end
# If the user doesn't have a cloud ID there is no need to involve the middleware.
return if user.cloud_user_id.nil?

runner = Runner.new(
user: user,
changes: changes,
Expand Down Expand Up @@ -58,7 +57,6 @@ def body
project_id: @cloud_service_config.admin_project_id,
},
user_info: {
billing_acct_id: @user.billing_acct_id,
cloud_user_id: @user.cloud_user_id,
new_data: {}.tap do |h|
h[:email] = @user.email if @changes[:email]
Expand Down
3 changes: 1 addition & 2 deletions spec/jobs/user_update_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
})
end

it "contains the user's cloud env and billing ids" do
it "contains the user's cloud env id" do
expect(subject[:user_info]).to be_a Hash
expect(subject[:user_info][:cloud_user_id]).to eq user.cloud_user_id
expect(subject[:user_info][:billing_acct_id]).to eq user.billing_acct_id
end

[
Expand Down

0 comments on commit 3815107

Please sign in to comment.