lib/deimos/utils/db_poller/state_based.rb in deimos-ruby-1.18.1 vs lib/deimos/utils/db_poller/state_based.rb in deimos-ruby-1.18.2
- old
+ new
@@ -16,11 +16,14 @@
# poll_query gets all the relevant data from the database, as defined
# by the producer itself.
loop do
Deimos.config.logger.debug("Polling #{@producer.topic}, batch #{status.current_batch}")
batch = fetch_results.to_a
- break if batch.empty?
+ if batch.empty?
+ @info.touch(:last_sent)
+ break
+ end
success = process_batch_with_span(batch, status)
finalize_batch(batch, success)
end
Deimos.config.logger.info("Poll #{@producer.topic} complete (#{status.report}")
@@ -33,10 +36,10 @@
# @param batch [Array<ActiveRecord::Base>]
# @param success [Boolean]
# @return [void]
def finalize_batch(batch, success)
- @info.touch
+ @info.touch(:last_sent)
state = success ? @config.published_state : @config.failed_state
klass = batch.first.class
id_col = klass.primary_key.to_sym
timestamp_col = @config.timestamp_column