Skip to content

Commit

Permalink
Simply make queue always false when @synchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
fzakaria committed Feb 14, 2020
1 parent fe7fb1d commit 7e70e9c
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -154,11 +154,8 @@ def ns_limited_queue?
def ns_execute(*args, &task)
ns_reset_if_forked

assigned_worker = ns_assign_worker(*args, &task)
if assigned_worker
if ns_assign_worker(*args, &task) || ns_enqueue(*args, &task)
@scheduled_task_count += 1
elsif !@synchronous
ns_enqueue(*args, &task)
else
handle_fallback(*args, &task)
end
Expand Down Expand Up @@ -213,6 +210,10 @@ def ns_assign_worker(*args, &task)
#
# @!visibility private
def ns_enqueue(*args, &task)
if @synchronous
return false
end

if !ns_limited_queue? || @queue.size < @max_queue
@queue << [task, args]
true
Expand Down

0 comments on commit 7e70e9c

Please sign in to comment.