Class: Webhookdb::Replicator::SponsyPublicationV1::Backfiller

Inherits:
Base::ServiceBackfiller show all
Defined in:
lib/webhookdb/replicator/sponsy_publication_v1.rb

Overview

Normal backfiller that keeps track of inserted items, and marks anything not backfilled as deleted.

Instance Attribute Summary

Attributes inherited from Base::ServiceBackfiller

#server_error_backoff, #server_error_retries, #svc

Instance Method Summary collapse

Methods inherited from Base::ServiceBackfiller

#__retryordie, #fetch_backfill_page, #initialize

Methods inherited from Backfiller

#_fetch_backfill_page_with_retry, #backfill, do_retry_wait, #fetch_backfill_page, #max_backfill_retry_attempts, #wait_for_retry_attempt

Constructor Details

This class inherits a constructor from Webhookdb::Replicator::Base::ServiceBackfiller

Instance Method Details

#flush_pending_insertsObject



119
120
121
122
123
# File 'lib/webhookdb/replicator/sponsy_publication_v1.rb', line 119

def flush_pending_inserts
  self.svc.admin_dataset do |ds|
    ds.exclude(sponsy_id: @seen_ids).where(deleted_at: nil).update(deleted_at: Sequel.function(:now))
  end
end

#handle_item(item) ⇒ Object



113
114
115
116
117
# File 'lib/webhookdb/replicator/sponsy_publication_v1.rb', line 113

def handle_item(item)
  super
  @seen_ids ||= []
  @seen_ids << item.fetch("id")
end