Class: Restforce::DB::Cleaner
- Inherits:
-
Object
- Object
- Restforce::DB::Cleaner
- Defined in:
- lib/restforce/db/cleaner.rb
Overview
Restforce::DB::Cleaner is responsible for culling the matching database records when a Salesforce record is no longer available to synchronize for a specific mapping.
Constant Summary collapse
- DELETION_READ_BUFFER =
Salesforce can take a few minutes to register record deletion. This buffer gives us a window of time (in seconds) to look back and see records which may not have been visible in previous runs.
3 * 60
Instance Method Summary collapse
-
#initialize(mapping, runner = Runner.new) ⇒ Cleaner
constructor
Public: Initialize a Restforce::DB::Cleaner.
-
#run ⇒ Object
Public: Run the database culling loop for this mapping.
Constructor Details
#initialize(mapping, runner = Runner.new) ⇒ Cleaner
Public: Initialize a Restforce::DB::Cleaner.
mapping - A Restforce::DB::Mapping. runner - A Restforce::DB::Runner.
19 20 21 22 23 |
# File 'lib/restforce/db/cleaner.rb', line 19 def initialize(mapping, runner = Runner.new) @mapping = mapping @strategy = mapping.strategy @runner = runner end |
Instance Method Details
#run ⇒ Object
Public: Run the database culling loop for this mapping.
Returns nothing.
28 29 30 |
# File 'lib/restforce/db/cleaner.rb', line 28 def run @mapping.database_record_type.destroy_all(dropped_salesforce_ids) end |