lowkiq 1.2.2 → 1.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97231d250b03b74533a83cc66b69aafcab6422a55b83ad4a479d4898c00a2b9b
4
- data.tar.gz: 6e29b0b370b9a201d10b3398fd1ed24a87efed091183a02cb29fea68625cf8fd
3
+ metadata.gz: 50333a828506189c2b2adb3d7899e762e1db37e438db6411cd43f185d6973fe6
4
+ data.tar.gz: a72a378c35f727c2556bc175df709b834ed9f82274286397166fb58239a16f3f
5
5
  SHA512:
6
- metadata.gz: 4275cf8a1235c9c5f527b40b011edaea72bebda8493128a8029c35c5cd166288ffb01187e39d6a301b132d27b3cd6d32f7b9f9cfec9d6fa0e3edfe943eaa0da2
7
- data.tar.gz: 46b65d96ffbc183fa47e85b487f88fe0d9aee256eb379be9fe20fcdc54c0239dcd4fecc2873c14a460024cb3f764c4a1797805b77c7b8d2f1078a40f14db404c
6
+ metadata.gz: 55ec85adda3935b865c309d510b60dd62258a40dc0ebd1db38cd67a26c3845752e2646943d81be77fb752910f9560ce40180f35aa5c398a8a7ae54364608a270
7
+ data.tar.gz: f9c5f352e3175d12f6dc15331971b16bd00471faa300b38e65424965c9afa3c1450a84d0a24cd00fc1ccd01b277e84a195e7d0433d85fef9cc8f56df2c75c95f
@@ -0,0 +1,34 @@
1
+ name: Rspec
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ jobs:
8
+ Rspec:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby-version:
13
+ - "2.6"
14
+ - "2.7"
15
+ - "3.0"
16
+ - "3.1"
17
+ - "3.2"
18
+ services:
19
+ redis:
20
+ image: redis:6.0
21
+ ports:
22
+ - 6379:6379
23
+ steps:
24
+ - name: Checkout action
25
+ uses: actions/checkout@v3
26
+ - name: Ruby setup
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true
31
+ - name: Run Rspec
32
+ run: bundle exec rspec
33
+ env:
34
+ REDIS_URL: redis:6379
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .rspec_status
2
2
  /assets
3
- /*.gem
3
+ /*.gem
4
+ /Gemfile.lock
data/LICENSE.md CHANGED
@@ -139,5 +139,5 @@ TIN/ 7810385714
139
139
  RRC/ 781001001
140
140
 
141
141
  Name and email address of the representative:<br>
142
- Mikhail Kuzmin<br>
143
- Mihail.Kuzmin@bia-tech.ru<br>
142
+ Sergey Staskov<br>
143
+ Sergey.Staskov@bia-tech.ru<br>
@@ -12,7 +12,7 @@ module Lowkiq
12
12
  def perform_all_jobs_now
13
13
  @pool.with do |redis|
14
14
  uredis = Utils::Redis.new redis
15
- redis.multi do
15
+ redis.multi do |pipeline|
16
16
  uredis.zresetscores @keys.all_ids_scored_by_perform_in_zset
17
17
  @queue.shards.each do |shard|
18
18
  uredis.zresetscores @keys.ids_scored_by_perform_in_zset(shard)
@@ -14,7 +14,7 @@ module Lowkiq
14
14
 
15
15
  def push(batch)
16
16
  @pool.with do |redis|
17
- redis.multi do
17
+ redis.multi do |pipeline|
18
18
  batch.each do |job|
19
19
  id = job.fetch(:id)
20
20
  perform_in = job.fetch(:perform_in, @timestamp.call)
@@ -24,12 +24,12 @@ module Lowkiq
24
24
 
25
25
  shard = id_to_shard id
26
26
 
27
- redis.zadd @keys.all_ids_lex_zset, 0, id
28
- redis.zadd @keys.all_ids_scored_by_perform_in_zset, perform_in, id, nx: true
29
- redis.zadd @keys.all_ids_scored_by_retry_count_zset, retry_count, id, nx: true
27
+ pipeline.zadd @keys.all_ids_lex_zset, 0, id
28
+ pipeline.zadd @keys.all_ids_scored_by_perform_in_zset, perform_in, id, nx: true
29
+ pipeline.zadd @keys.all_ids_scored_by_retry_count_zset, retry_count, id, nx: true
30
30
 
31
- redis.zadd @keys.ids_scored_by_perform_in_zset(shard), perform_in, id, nx: true
32
- redis.zadd @keys.payloads_zset(id), score, Lowkiq.dump_payload.call(payload), nx: true
31
+ pipeline.zadd @keys.ids_scored_by_perform_in_zset(shard), perform_in, id, nx: true
32
+ pipeline.zadd @keys.payloads_zset(id), score, Lowkiq.dump_payload.call(payload), nx: true
33
33
  end
34
34
  end
35
35
  end
@@ -42,29 +42,29 @@ module Lowkiq
42
42
  limit: [0, limit]
43
43
  return [] if ids.empty?
44
44
 
45
- res = redis.multi do |redis|
46
- redis.hset @keys.processing_length_by_shard_hash, shard, ids.length
45
+ res = redis.multi do |pipeline|
46
+ pipeline.hset @keys.processing_length_by_shard_hash, shard, ids.length
47
47
 
48
48
  ids.each do |id|
49
- redis.zrem @keys.all_ids_lex_zset, id
50
- redis.zrem @keys.ids_scored_by_perform_in_zset(shard), id
49
+ pipeline.zrem @keys.all_ids_lex_zset, id
50
+ pipeline.zrem @keys.ids_scored_by_perform_in_zset(shard), id
51
51
 
52
- Script.zremhset redis,
52
+ Script.zremhset pipeline,
53
53
  @keys.all_ids_scored_by_perform_in_zset,
54
54
  @keys.processing_ids_with_perform_in_hash(shard),
55
55
  id
56
- Script.zremhset redis,
56
+ Script.zremhset pipeline,
57
57
  @keys.all_ids_scored_by_retry_count_zset,
58
58
  @keys.processing_ids_with_retry_count_hash(shard),
59
59
  id
60
- redis.rename @keys.payloads_zset(id),
60
+ pipeline.rename @keys.payloads_zset(id),
61
61
  @keys.processing_payloads_zset(id)
62
- Script.hmove redis,
62
+ Script.hmove pipeline,
63
63
  @keys.errors_hash,
64
64
  @keys.processing_errors_hash(shard),
65
65
  id
66
66
  end
67
- processing_data_pipeline(redis, shard, ids)
67
+ processing_data_pipeline(pipeline, shard, ids)
68
68
  end
69
69
 
70
70
  res.shift 1 + ids.length * 6
@@ -75,7 +75,7 @@ module Lowkiq
75
75
  def push_back(batch)
76
76
  @pool.with do |redis|
77
77
  timestamp = @timestamp.call
78
- redis.multi do |redis|
78
+ redis.multi do |pipeline|
79
79
  batch.each do |job|
80
80
  id = job.fetch(:id)
81
81
  perform_in = job.fetch(:perform_in, timestamp)
@@ -87,14 +87,14 @@ module Lowkiq
87
87
 
88
88
  shard = id_to_shard id
89
89
 
90
- redis.zadd @keys.all_ids_lex_zset, 0, id
91
- redis.zadd @keys.all_ids_scored_by_perform_in_zset, perform_in, id
92
- redis.zadd @keys.all_ids_scored_by_retry_count_zset, retry_count, id
90
+ pipeline.zadd @keys.all_ids_lex_zset, 0, id
91
+ pipeline.zadd @keys.all_ids_scored_by_perform_in_zset, perform_in, id
92
+ pipeline.zadd @keys.all_ids_scored_by_retry_count_zset, retry_count, id
93
93
 
94
- redis.zadd @keys.ids_scored_by_perform_in_zset(shard), perform_in, id
95
- redis.zadd @keys.payloads_zset(id), payloads, nx: true
94
+ pipeline.zadd @keys.ids_scored_by_perform_in_zset(shard), perform_in, id
95
+ pipeline.zadd @keys.payloads_zset(id), payloads, nx: true
96
96
 
97
- redis.hset @keys.errors_hash, id, error unless error.nil?
97
+ pipeline.hset @keys.errors_hash, id, error unless error.nil?
98
98
  end
99
99
  end
100
100
  end
@@ -105,16 +105,16 @@ module Lowkiq
105
105
  length = ids.length
106
106
 
107
107
  @pool.with do |redis|
108
- redis.multi do
109
- redis.del @keys.processing_ids_with_perform_in_hash(shard)
110
- redis.del @keys.processing_ids_with_retry_count_hash(shard)
111
- redis.del @keys.processing_errors_hash(shard)
108
+ redis.multi do |pipeline|
109
+ pipeline.del @keys.processing_ids_with_perform_in_hash(shard)
110
+ pipeline.del @keys.processing_ids_with_retry_count_hash(shard)
111
+ pipeline.del @keys.processing_errors_hash(shard)
112
112
  ids.each do |id|
113
- redis.del @keys.processing_payloads_zset(id)
113
+ pipeline.del @keys.processing_payloads_zset(id)
114
114
  end
115
- redis.hdel @keys.processing_length_by_shard_hash, shard
116
- redis.incrby @keys.processed_key, length if result == :success
117
- redis.incrby @keys.failed_key, length if result == :fail
115
+ pipeline.hdel @keys.processing_length_by_shard_hash, shard
116
+ pipeline.incrby @keys.processed_key, length if result == :success
117
+ pipeline.incrby @keys.failed_key, length if result == :fail
118
118
  end
119
119
  end
120
120
  end
@@ -124,8 +124,8 @@ module Lowkiq
124
124
  ids = redis.hkeys @keys.processing_ids_with_perform_in_hash(shard)
125
125
  return [] if ids.empty?
126
126
 
127
- res = redis.multi do |redis|
128
- processing_data_pipeline redis, shard, ids
127
+ res = redis.multi do |pipeline|
128
+ processing_data_pipeline pipeline, shard, ids
129
129
  end
130
130
 
131
131
  processing_data_build res, ids
@@ -135,7 +135,7 @@ module Lowkiq
135
135
  def push_to_morgue(batch)
136
136
  @pool.with do |redis|
137
137
  timestamp = @timestamp.call
138
- redis.multi do
138
+ redis.multi do |pipeline|
139
139
  batch.each do |job|
140
140
  id = job.fetch(:id)
141
141
  payloads = job.fetch(:payloads).map do |(payload, score)|
@@ -144,11 +144,11 @@ module Lowkiq
144
144
  error = Lowkiq.dump_error.call(job.fetch(:error, nil))
145
145
 
146
146
 
147
- redis.zadd @keys.morgue_all_ids_lex_zset, 0, id
148
- redis.zadd @keys.morgue_all_ids_scored_by_updated_at_zset, timestamp, id
149
- redis.zadd @keys.morgue_payloads_zset(id), payloads, nx: true
147
+ pipeline.zadd @keys.morgue_all_ids_lex_zset, 0, id
148
+ pipeline.zadd @keys.morgue_all_ids_scored_by_updated_at_zset, timestamp, id
149
+ pipeline.zadd @keys.morgue_payloads_zset(id), payloads, nx: true
150
150
 
151
- redis.hset @keys.morgue_errors_hash, id, error unless error.nil?
151
+ pipeline.hset @keys.morgue_errors_hash, id, error unless error.nil?
152
152
  end
153
153
  end
154
154
  end
@@ -156,12 +156,12 @@ module Lowkiq
156
156
 
157
157
  def morgue_delete(ids)
158
158
  @pool.with do |redis|
159
- redis.multi do
159
+ redis.multi do |pipeline|
160
160
  ids.each do |id|
161
- redis.zrem @keys.morgue_all_ids_lex_zset, id
162
- redis.zrem @keys.morgue_all_ids_scored_by_updated_at_zset, id
163
- redis.del @keys.morgue_payloads_zset(id)
164
- redis.hdel @keys.morgue_errors_hash, id
161
+ pipeline.zrem @keys.morgue_all_ids_lex_zset, id
162
+ pipeline.zrem @keys.morgue_all_ids_scored_by_updated_at_zset, id
163
+ pipeline.del @keys.morgue_payloads_zset(id)
164
+ pipeline.hdel @keys.morgue_errors_hash, id
165
165
  end
166
166
  end
167
167
  end
@@ -169,15 +169,15 @@ module Lowkiq
169
169
 
170
170
  def delete(ids)
171
171
  @pool.with do |redis|
172
- redis.multi do
172
+ redis.multi do |pipeline|
173
173
  ids.each do |id|
174
174
  shard = id_to_shard id
175
- redis.zrem @keys.all_ids_lex_zset, id
176
- redis.zrem @keys.all_ids_scored_by_perform_in_zset, id
177
- redis.zrem @keys.all_ids_scored_by_retry_count_zset, id
178
- redis.zrem @keys.ids_scored_by_perform_in_zset(shard), id
179
- redis.del @keys.payloads_zset(id)
180
- redis.hdel @keys.errors_hash, id
175
+ pipeline.zrem @keys.all_ids_lex_zset, id
176
+ pipeline.zrem @keys.all_ids_scored_by_perform_in_zset, id
177
+ pipeline.zrem @keys.all_ids_scored_by_retry_count_zset, id
178
+ pipeline.zrem @keys.ids_scored_by_perform_in_zset(shard), id
179
+ pipeline.del @keys.payloads_zset(id)
180
+ pipeline.hdel @keys.errors_hash, id
181
181
  end
182
182
  end
183
183
  end
@@ -9,8 +9,8 @@ module Lowkiq
9
9
  def call(queues)
10
10
  result = @redis_pool.with do |redis|
11
11
  #redis.pipelined do
12
- redis.multi do
13
- queues.each { |queue| pipeline redis, queue }
12
+ redis.multi do |rs|
13
+ queues.each { |queue| pipeline rs, queue }
14
14
  end
15
15
  end
16
16
 
@@ -1,3 +1,3 @@
1
1
  module Lowkiq
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
data/lowkiq.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "lowkiq"
7
7
  spec.version = Lowkiq::VERSION
8
8
  spec.authors = ["Mikhail Kuzmin"]
9
- spec.email = ["Mihail.Kuzmin@bia-tech.ru"]
9
+ spec.email = ["m.kuzmin@darkleaf.ru"]
10
10
 
11
11
  spec.summary = %q{Lowkiq}
12
12
  spec.description = %q{Lowkiq}
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  `git ls-files -z`
20
20
  .split("\x0")
21
21
  .reject { |f| f.match(%r{^(spec|frontend|examples|doc)/}) }
22
- .push('assets/app.js')
23
22
  end
24
23
  spec.bindir = "exe"
25
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -34,5 +33,5 @@ Gem::Specification.new do |spec|
34
33
  spec.add_development_dependency "rspec", "~> 3.0"
35
34
  spec.add_development_dependency "rspec-mocks", "~> 3.8"
36
35
  spec.add_development_dependency "rack-test", "~> 1.1"
37
- spec.add_development_dependency "pry-byebug", "~> 3.9.0"
36
+ spec.add_development_dependency "pry-byebug", ">= 3.9.0"
38
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lowkiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Kuzmin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-10 00:00:00.000000000 Z
11
+ date: 2026-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -138,34 +138,33 @@ dependencies:
138
138
  name: pry-byebug
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - "~>"
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: 3.9.0
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - "~>"
148
+ - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: 3.9.0
151
151
  description: Lowkiq
152
152
  email:
153
- - Mihail.Kuzmin@bia-tech.ru
153
+ - m.kuzmin@darkleaf.ru
154
154
  executables:
155
155
  - lowkiq
156
156
  extensions: []
157
157
  extra_rdoc_files: []
158
158
  files:
159
+ - ".github/workflows/rspec.yml"
159
160
  - ".gitignore"
160
161
  - ".rspec"
161
162
  - CHANGELOG.md
162
163
  - Gemfile
163
- - Gemfile.lock
164
164
  - LICENSE.md
165
165
  - README.md
166
166
  - README.ru.md
167
167
  - Rakefile
168
- - assets/app.js
169
168
  - bin/console
170
169
  - bin/setup
171
170
  - deploy.md
@@ -215,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
214
  - !ruby/object:Gem::Version
216
215
  version: '0'
217
216
  requirements: []
218
- rubygems_version: 3.2.22
217
+ rubygems_version: 3.0.3.1
219
218
  signing_key:
220
219
  specification_version: 4
221
220
  summary: Lowkiq
data/Gemfile.lock DELETED
@@ -1,55 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- lowkiq (1.2.1)
5
- connection_pool (~> 2.2, >= 2.2.2)
6
- rack (>= 1.5.0)
7
- redis (>= 4.0.1, < 5)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- byebug (11.1.3)
13
- coderay (1.1.3)
14
- connection_pool (2.2.5)
15
- diff-lcs (1.3)
16
- method_source (1.0.0)
17
- pry (0.13.1)
18
- coderay (~> 1.1)
19
- method_source (~> 1.0)
20
- pry-byebug (3.9.0)
21
- byebug (~> 11.0)
22
- pry (~> 0.13.0)
23
- rack (2.2.2)
24
- rack-test (1.1.0)
25
- rack (>= 1.0, < 3)
26
- rake (12.3.3)
27
- redis (4.7.1)
28
- rspec (3.9.0)
29
- rspec-core (~> 3.9.0)
30
- rspec-expectations (~> 3.9.0)
31
- rspec-mocks (~> 3.9.0)
32
- rspec-core (3.9.1)
33
- rspec-support (~> 3.9.1)
34
- rspec-expectations (3.9.0)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.9.0)
37
- rspec-mocks (3.9.1)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.9.0)
40
- rspec-support (3.9.2)
41
-
42
- PLATFORMS
43
- ruby
44
-
45
- DEPENDENCIES
46
- bundler (~> 2.1)
47
- lowkiq!
48
- pry-byebug (~> 3.9.0)
49
- rack-test (~> 1.1)
50
- rake (~> 12.3.0)
51
- rspec (~> 3.0)
52
- rspec-mocks (~> 3.8)
53
-
54
- BUNDLED WITH
55
- 2.2.22