Class: Restforce::DB::Attacher

Inherits:
Task
  • Object
show all
Defined in:
lib/restforce/db/attacher.rb

Overview

Restforce::DB::Attacher is responsible for cleaning up any orphaned upserted Salesforce records with the database records that they were originally supposed to be attached to. This allows us to successfully handle cases where a request timeout or partial failure would otherwise leave an upserted Salesforce record stranded without a related database record.

Instance Method Summary collapse

Methods inherited from Task

#initialize

Constructor Details

This class inherits a constructor from Restforce::DB::Task

Instance Method Details

#run(*_) ⇒ Object

Public: Run the re-attachment process for any unsynchronized Salesforce records which have an external upsert ID.

Returns nothing.



17
18
19
20
21
22
23
# File 'lib/restforce/db/attacher.rb', line 17

def run(*_)
  return if @mapping.strategy.passive?

  @runner.run(@mapping) do |run|
    run.salesforce_instances.each { |instance| attach(instance) }
  end
end