Skip to content

Commit

Permalink
Merge pull request #2472 from cloudnativedaysjp/fix/stop-later
Browse files Browse the repository at this point in the history
fix: stop to active job
  • Loading branch information
jacopen authored Nov 27, 2024
2 parents dc91ec5 + 2a4131a commit f2ceff1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/check_in_conferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
check_in_timestamp = Time.zone.at(@params[:checkInTimestamp])
@check_in = CheckInConference.new(profile: attendee, conference:, check_in_timestamp:, scanner_profile_id: @profile.id)
conference = Conference.find_by(abbr: @params[:eventAbbr])
GenerateEntrysheetJob.perform_later(conference.id, attendee.id, speaker&.id, @params[:printerId])
GenerateEntrysheetJob.perform_now(conference.id, attendee.id, speaker&.id, @params[:printerId])

if @check_in.save
render(json: @check_in, status: :created)
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/generate_entrysheet_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ def perform(conference_id, profile_id, speaker_id = nil, printer_id = nil)
response = client.create_printjob(job)

puts("印刷ジョブID: #{response}")
ensure
File.exist?(pdf_file) && File.delete(pdf_file)
end
end
1 change: 1 addition & 0 deletions spec/requests/api/v1/check_in_conferences_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
context 'create' do
before do
allow(JsonWebToken).to(receive(:verify).and_return(alice_claim))
allow(GenerateEntrysheetJob).to(receive(:perform_now))
end

it 'return ok' do
Expand Down

0 comments on commit f2ceff1

Please sign in to comment.