git-fit 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/git_fit/sync/runner.rb +13 -7
- data/lib/git_fit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b08e4aac65236128444a75e0890cdaf1e8b25f08a1db325833c7e6c240019b98
|
|
4
|
+
data.tar.gz: b028cc241a518348434988519e5602cbe624d73e80f0b3e5bfbfb0bbe13660ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62d0a2b6b23b44c8d56254fa695fcd5735052319261cb6b146143b88910f704c2eb2df77544bcb23b490409ed271e495d7bade5fff25d6c32e8a9dbb9d717e63
|
|
7
|
+
data.tar.gz: 6ab10823f7a8d558de35ef6eb51d11d7aa88d03a9d61d175623355d5a1f159cfd6a23c7985836b8edf26ce0284e61d99f1506792c1f3017a62852dfbdc493d1c
|
data/lib/git_fit/sync/runner.rb
CHANGED
|
@@ -32,6 +32,8 @@ module GitFit
|
|
|
32
32
|
@shutdown = false
|
|
33
33
|
@source_start_times = {}
|
|
34
34
|
@source_activated = {}
|
|
35
|
+
@run_totals = {}
|
|
36
|
+
@run_processed = {}
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
def run
|
|
@@ -128,6 +130,8 @@ module GitFit
|
|
|
128
130
|
@adapters.delete(source)
|
|
129
131
|
@source_start_times.delete(source)
|
|
130
132
|
@source_activated.delete(source)
|
|
133
|
+
@run_totals.delete(source)
|
|
134
|
+
@run_processed.delete(source)
|
|
131
135
|
end
|
|
132
136
|
|
|
133
137
|
def worker_loop
|
|
@@ -156,13 +160,13 @@ module GitFit
|
|
|
156
160
|
end
|
|
157
161
|
|
|
158
162
|
def process_source(source)
|
|
159
|
-
@stats_lock.synchronize { @source_start_times[source] ||= Time.now }
|
|
160
163
|
unless init_source(source)
|
|
161
164
|
finish_activity(source)
|
|
162
165
|
return
|
|
163
166
|
end
|
|
167
|
+
@stats_lock.synchronize { @source_start_times[source] ||= Time.now }
|
|
164
168
|
|
|
165
|
-
total = @pending_ids[source].size
|
|
169
|
+
total = @run_totals[source] ||= @pending_ids[source].size
|
|
166
170
|
processed = 0
|
|
167
171
|
timed_out_local = false
|
|
168
172
|
auth_failed_local = false
|
|
@@ -209,6 +213,8 @@ module GitFit
|
|
|
209
213
|
break if processed >= BATCH_SIZE
|
|
210
214
|
end
|
|
211
215
|
|
|
216
|
+
@run_processed[source] = (@run_processed[source] || 0) + processed
|
|
217
|
+
|
|
212
218
|
if auth_failed_local
|
|
213
219
|
finish_activity(source, true, 're-auth failed')
|
|
214
220
|
else
|
|
@@ -246,10 +252,11 @@ module GitFit
|
|
|
246
252
|
end
|
|
247
253
|
|
|
248
254
|
def report_activity_progress(source, activity, result, processed, total)
|
|
255
|
+
acc = (@run_processed[source] || 0) + processed
|
|
249
256
|
info = result ? @adapters[source].build_progress_info(result) : nil
|
|
250
257
|
@output_queue << {
|
|
251
258
|
type: :progress, source:, id: activity[:id],
|
|
252
|
-
info:, done:
|
|
259
|
+
info:, done: acc, total:
|
|
253
260
|
}
|
|
254
261
|
end
|
|
255
262
|
|
|
@@ -352,7 +359,7 @@ module GitFit
|
|
|
352
359
|
elsif (cnt = info[:done]) && cnt > 0
|
|
353
360
|
label = "#{cnt} synced"
|
|
354
361
|
label += ", #{err} errors" if err > 0
|
|
355
|
-
label +=
|
|
362
|
+
label += ' (auth failed)' if info[:auth_failed]
|
|
356
363
|
$stdout.puts " done: #{s}: #{label}"
|
|
357
364
|
elsif info[:auth_failed]
|
|
358
365
|
$stdout.puts " done: #{s}: 0 synced (auth failed)"
|
|
@@ -369,10 +376,9 @@ module GitFit
|
|
|
369
376
|
end
|
|
370
377
|
|
|
371
378
|
def show_progress?(done, total)
|
|
372
|
-
return true if done.nil?
|
|
379
|
+
return true if done.nil?
|
|
373
380
|
return true if total && (total - done) <= 5
|
|
374
|
-
|
|
375
|
-
step <= 1 || done % step == 0
|
|
381
|
+
done % BATCH_SIZE == 1
|
|
376
382
|
end
|
|
377
383
|
end
|
|
378
384
|
end
|
data/lib/git_fit/version.rb
CHANGED