From 8c3d35f9603453c142c5afa1fd9d15c4e6a4bab9 Mon Sep 17 00:00:00 2001 From: Daniel Berger Date: Thu, 20 Jul 2017 11:12:27 -0400 Subject: [PATCH] Check for messages key in prefetch_below_threshold? --- app/models/miq_server/worker_management/dequeue.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/miq_server/worker_management/dequeue.rb b/app/models/miq_server/worker_management/dequeue.rb index b8f4abfeb39..13de06a89cc 100644 --- a/app/models/miq_server/worker_management/dequeue.rb +++ b/app/models/miq_server/worker_management/dequeue.rb @@ -61,7 +61,7 @@ def prefetch_stale_threshold def prefetch_below_threshold?(queue_name, wcount) @queue_messages_lock.synchronize(:SH) do - return false if @queue_messages[queue_name].nil? + return false unless @queue_messages.key_path?(queue_name, :messages) return (@queue_messages[queue_name][:messages].length <= (::Settings.server.prefetch_min_per_worker_dequeue * wcount)) end end