Skip to content

Commit

Permalink
lower priority (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
vswamidass-sfdc authored Oct 23, 2024
1 parent f50dd15 commit 689cfe9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/jobs/sync_quip_doc_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def perform(_doc_id)
document.last_sync_result = 'SUCCESS'
document.save!
# Reschedule the job to run again in 24 hours
SyncQuipDocJob.set(wait: 24.hours).perform_later(_doc_id)
SyncQuipDocJob.set(wait: 24.hours, priority: 10).perform_later(_doc_id)
return
rescue ActiveRecord::RecordInvalid => e
# Handle save! failures (validation errors)
Expand All @@ -49,6 +49,6 @@ def perform(_doc_id)

document.last_sync_result = 'FAILED'
document.save
SyncQuipDocJob.set(wait: 30.minutes).perform_later(_doc_id)
SyncQuipDocJob.set(wait: 30.minutes, priority: 10).perform_later(_doc_id)
end
end
2 changes: 1 addition & 1 deletion app/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def sync_quip_doc_if_needed

self.last_sync_result = 'SCHEDULED'

SyncQuipDocJob.set(wait: 5.seconds).perform_later(id) # Add delay to prevent race condition with schedule jobs
SyncQuipDocJob.set(wait: 5.seconds, priority: 10).perform_later(id) # Add delay to prevent race condition with schedule jobs
end

# Schedule the EmbedDocumentJob with a delay based on the number of jobs in the queue
Expand Down

0 comments on commit 689cfe9

Please sign in to comment.