Skip to content

Commit

Permalink
Check if queue would be full when doing batch create.
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanzdosilovic committed Jan 16, 2020
1 parent 6420156 commit 87859b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def check_wait
end

def check_queue_size
if Resque.size(ENV["JUDGE0_VERSION"]) >= Config::MAX_QUEUE_SIZE
number_of_submissions = params[:_json].try(:size).presence || 1
if Resque.size(ENV["JUDGE0_VERSION"]) + number_of_submissions > Config::MAX_QUEUE_SIZE
render json: { error: "queue is full" }, status: :service_unavailable
end
end
Expand Down

0 comments on commit 87859b5

Please sign in to comment.