sbmt-outbox 6.18.0 → 6.19.1
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/app/jobs/sbmt/outbox/base_delete_stale_items_job.rb +13 -2
- data/lib/sbmt/outbox/version.rb +1 -1
- 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: 4bac4fb00e9e7ed83bcac6615de205d21fc5868fe371fd847bf9349f2a48849e
|
|
4
|
+
data.tar.gz: 71db4cfc1c0fb36399f214ef70b88b8b1752231d5ffb2ebbf6e76b71b487c755
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c9cf6a0e0cb436e22ced29364a2a1a724f7094c5d307b1f96f3761c4c53f78f514b53ec392c3d41f704195f015d9071b5eaed1d92e95e570d3533daf87395b1
|
|
7
|
+
data.tar.gz: 223d97189ef52c2eb2cf1a675d29a67283cd36198676b0f2f2b0d89354033b947c06aa10a6db4986317d584f06680dccf07aeddadd73f3672e8344f4f419e01f
|
|
@@ -117,7 +117,12 @@ module Sbmt
|
|
|
117
117
|
table = item_class.arel_table
|
|
118
118
|
batch_size = item_class.config.deletion_batch_size
|
|
119
119
|
time_window = item_class.config.deletion_time_window
|
|
120
|
-
min_date =
|
|
120
|
+
min_date = Outbox.database_switcher.use_slave do
|
|
121
|
+
# This query assumes that record with minimum 'id' also has minimum 'created_at'.
|
|
122
|
+
# We use it because it should be faster than plain 'SELECT MIN(created_at) ...'.
|
|
123
|
+
min_id = item_class.select(table[:id].minimum).where(status: statuses)
|
|
124
|
+
item_class.select(:created_at).where(table[:id].eq(min_id.arel)).first&.created_at
|
|
125
|
+
end
|
|
121
126
|
deleted_count = nil
|
|
122
127
|
|
|
123
128
|
while min_date && min_date < waterline
|
|
@@ -172,9 +177,15 @@ module Sbmt
|
|
|
172
177
|
end
|
|
173
178
|
|
|
174
179
|
def delete_items_in_batches_with_between_mysql(waterline, statuses)
|
|
180
|
+
table = item_class.arel_table
|
|
175
181
|
batch_size = item_class.config.deletion_batch_size
|
|
176
182
|
time_window = item_class.config.deletion_time_window
|
|
177
|
-
min_date =
|
|
183
|
+
min_date = Outbox.database_switcher.use_slave do
|
|
184
|
+
# This query assumes that record with minimum 'id' also has minimum 'created_at'.
|
|
185
|
+
# We use it because plain 'SELECT MIN(created_at) ...' is VERY slow in MySQL.
|
|
186
|
+
min_id = item_class.select(table[:id].minimum).where(status: statuses)
|
|
187
|
+
item_class.select(:created_at).where(table[:id].eq(min_id.arel)).first&.created_at
|
|
188
|
+
end
|
|
178
189
|
deleted_count = nil
|
|
179
190
|
|
|
180
191
|
while min_date && min_date < waterline
|
data/lib/sbmt/outbox/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sbmt-outbox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.19.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sbermarket Ruby-Platform Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-02-
|
|
11
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: connection_pool
|
|
@@ -630,7 +630,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
630
630
|
- !ruby/object:Gem::Version
|
|
631
631
|
version: '0'
|
|
632
632
|
requirements: []
|
|
633
|
-
rubygems_version: 3.
|
|
633
|
+
rubygems_version: 3.5.23
|
|
634
634
|
signing_key:
|
|
635
635
|
specification_version: 4
|
|
636
636
|
summary: Outbox service
|