restforce-db 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/restforce/db/version.rb +1 -1
- data/lib/restforce/db/worker.rb +14 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 530452ffeea884be628f06f4227de2fe1404ebc4
|
4
|
+
data.tar.gz: 2b94172a1c712955af08ac61f3131a1de4d3ea83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb953ba90c351994aeccef4fd2ffefefe5364955fa6c566098166f5053d74f121a4d2cc69629bba386c96b932d7a7c8ad657dcc609c359cbb50c75b4cd3aa08
|
7
|
+
data.tar.gz: d1e69dfef74e097947fcbe5abfaa31aa2d6b73e74e373ae2ad9605db9c0445ed26717c1b8531cec1e624b27adc1bcc3a13dea3ab25da40448be1199495a45548
|
data/lib/restforce/db/version.rb
CHANGED
data/lib/restforce/db/worker.rb
CHANGED
@@ -25,7 +25,7 @@ module Restforce
|
|
25
25
|
def initialize(options = {})
|
26
26
|
@verbose = options.fetch(:verbose) { false }
|
27
27
|
@interval = options.fetch(:interval) { DEFAULT_INTERVAL }
|
28
|
-
@
|
28
|
+
@delay = options.fetch(:delay) { DEFAULT_DELAY }
|
29
29
|
|
30
30
|
DB.reset
|
31
31
|
DB.configure { |config| config.parse(options[:config]) }
|
@@ -71,10 +71,10 @@ module Restforce
|
|
71
71
|
#
|
72
72
|
# Returns nothing.
|
73
73
|
def perform
|
74
|
-
@runner.tick!
|
75
|
-
@changes = Hash.new { |h, k| h[k] = Accumulator.new }
|
76
|
-
|
77
74
|
track do
|
75
|
+
runner.tick!
|
76
|
+
@changes = Hash.new { |h, k| h[k] = Accumulator.new }
|
77
|
+
|
78
78
|
Restforce::DB::Mapping.each do |mapping|
|
79
79
|
task("PROPAGATING RECORDS", mapping) { propagate mapping }
|
80
80
|
task("COLLECTING CHANGES", mapping) { collect mapping }
|
@@ -112,6 +112,14 @@ module Restforce
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
# Internal: Get a Runner object which can be passed to the various
|
116
|
+
# workflow objects to scope their record lookups.
|
117
|
+
#
|
118
|
+
# Returns a Restforce::DB::Runner.
|
119
|
+
def runner
|
120
|
+
@runner ||= Runner.new(@delay)
|
121
|
+
end
|
122
|
+
|
115
123
|
# Internal: Propagate unsynchronized records between the two systems for
|
116
124
|
# the passed mapping.
|
117
125
|
#
|
@@ -119,7 +127,7 @@ module Restforce
|
|
119
127
|
#
|
120
128
|
# Returns nothing.
|
121
129
|
def propagate(mapping)
|
122
|
-
Initializer.new(mapping,
|
130
|
+
Initializer.new(mapping, runner).run
|
123
131
|
end
|
124
132
|
|
125
133
|
# Internal: Collect a list of changes from recently-updated records for
|
@@ -129,7 +137,7 @@ module Restforce
|
|
129
137
|
#
|
130
138
|
# Returns nothing.
|
131
139
|
def collect(mapping)
|
132
|
-
Collector.new(mapping,
|
140
|
+
Collector.new(mapping, runner).run(@changes)
|
133
141
|
end
|
134
142
|
|
135
143
|
# Internal: Apply the aggregated changes to the objects in both systems,
|