backfiller 0.2.0 → 0.2.2
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/Changelog.md +14 -6
- data/README.md +5 -0
- data/backfiller.gemspec +1 -1
- data/lib/backfiller/railtie.rb +0 -2
- data/lib/backfiller/runner.rb +8 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c24e062cc5912339de434c17eabe729dcc48df6a361b891ba3c23985bc0bd92
|
|
4
|
+
data.tar.gz: d26a5b2bd63c94c1453ab0160463c446532c6fa8279b5bb0d049fe32d14f4785
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0650a73d5913a0a5a742adddcf07fc7c5c802f1b2d5e7a03f7e46c5d77872274af134ad20495e7cb7f9a56ba3bf9f7e189584135b2508280bac94756c6421340
|
|
7
|
+
data.tar.gz: ad1ffc87d70618cbd348633fceebcccad553d148677464791548e0725b491edf7a2fad8e6e2f3bb3b9f57e97ce2a181328746cb9a75d7e7a4f12752f5987c381
|
data/Changelog.md
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
- Always release connections in runner (#5).
|
|
6
|
+
|
|
7
|
+
## 0.2.1
|
|
8
|
+
|
|
9
|
+
- `cursor_threshold` is nil by default.
|
|
10
|
+
|
|
3
11
|
## 0.2.0
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
- Upgrade local gems
|
|
14
|
+
- Add rubocop
|
|
15
|
+
- Add specs
|
|
16
|
+
- Configure travis
|
|
17
|
+
- Add `cursor_threshold` feature
|
|
10
18
|
|
|
11
19
|
## 0.1.1
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
- Support Rails 6.0.0
|
data/README.md
CHANGED
|
@@ -168,6 +168,7 @@ For Rails application backfiller is initialized with next options
|
|
|
168
168
|
* task_directory: `RAILS_ROOT/db/backfill`
|
|
169
169
|
* task_namespace: `Backfill`
|
|
170
170
|
* batch_size: `1_000`
|
|
171
|
+
* cursor_threshold: `nil`
|
|
171
172
|
* connection_pool: `ApplicationRecord.connection_pool`
|
|
172
173
|
* logger: `ApplicationRecord.logger`
|
|
173
174
|
|
|
@@ -186,6 +187,10 @@ class Backfill::Foo
|
|
|
186
187
|
def batch_size
|
|
187
188
|
100
|
|
188
189
|
end
|
|
190
|
+
|
|
191
|
+
def cursor_threshold
|
|
192
|
+
100_000
|
|
193
|
+
end
|
|
189
194
|
end
|
|
190
195
|
```
|
|
191
196
|
|
data/backfiller.gemspec
CHANGED
data/lib/backfiller/railtie.rb
CHANGED
data/lib/backfiller/runner.rb
CHANGED
|
@@ -46,12 +46,14 @@ module Backfiller
|
|
|
46
46
|
master_connection = acquire_connection
|
|
47
47
|
worker_connection = acquire_connection
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
begin
|
|
50
|
+
run_cursor_loop(master_connection) do |row|
|
|
51
|
+
process_method.call(worker_connection, row)
|
|
52
|
+
end
|
|
53
|
+
ensure
|
|
54
|
+
release_connection(master_connection)
|
|
55
|
+
release_connection(worker_connection)
|
|
51
56
|
end
|
|
52
|
-
|
|
53
|
-
release_connection(master_connection)
|
|
54
|
-
release_connection(worker_connection)
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
private
|
|
@@ -114,7 +116,7 @@ module Backfiller
|
|
|
114
116
|
|
|
115
117
|
Backfiller.log "Processed #{count}"
|
|
116
118
|
|
|
117
|
-
return [false, count] if count > cursor_threshold
|
|
119
|
+
return [false, count] if cursor_threshold && count > cursor_threshold
|
|
118
120
|
end
|
|
119
121
|
end
|
|
120
122
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: backfiller
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andriy Yanko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
141
|
version: '0'
|
|
142
142
|
requirements: []
|
|
143
|
-
rubygems_version: 3.
|
|
143
|
+
rubygems_version: 3.3.26
|
|
144
144
|
signing_key:
|
|
145
145
|
specification_version: 4
|
|
146
146
|
summary: Backfiller for null database columns
|