We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d115e93 commit b5a6cf9Copy full SHA for b5a6cf9
1 file changed
app/background_tasks/submission_long_queue_processor_task.rb
@@ -0,0 +1,24 @@
1
+# frozen_string_literal: true
2
+
3
+require 'submission_processor'
4
5
+class SubmissionLongQueueProcessorTask
6
+ def initialize
7
+ @processor = SubmissionProcessor.new
8
+ end
9
10
+ def run
11
+ queue = Submission.to_be_reprocessed.where(processing_priority: 0).order(:created_at).reverse_order
12
+ return if queue.length <= 10
13
+ Rails.logger.info "#{queue.length} high priority submissions in queue, trying to process some of them in reverse order..."
14
+ queue.limit(RemoteSandbox.total_capacity).each do |sub|
15
+ Rails.logger.info "Processing submission #{sub} in from the front of the queue since submission queue is so long..."
16
+ @processor.process_submission(sub)
17
+ Rails.logger.info "Processing submission #{sub} done"
18
19
20
21
+ def wait_delay
22
+ 1
23
24
+end
0 commit comments