lib/toiler/actor/fetcher.rb in toiler-0.5.1.pre5 vs lib/toiler/actor/fetcher.rb in toiler-0.5.1.pre6

- old
+ new

@@ -65,22 +65,28 @@ wait_time_seconds: wait, max_number_of_messages: max_number_of_messages end end + def release_messages(messages) + @waiting_messages -= messages + end + def poll_messages return unless should_poll? max_number_of_messages = max_messages @waiting_messages += max_number_of_messages debug "Fetcher #{queue.name} polling messages..." future = poll_future max_number_of_messages future.on_rejection! do + tell [:release_messages, max_number_of_messages] tell :poll_messages end future.on_fulfillment! do |msgs| tell [:assign_messages, msgs] if !msgs.nil? && !msgs.empty? + tell [:release_messages, max_number_of_messages] tell :poll_messages end tell :poll_messages if should_poll? end