lowkiq 1.2.4 → 1.2.5

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: 840022deafa256f5c957aeecf78ecebe5825318867b017e0116fecc882d6fae4
4
- data.tar.gz: eff0fb44702bbd08fec5e415e0da7c796ac6d496255239dd19c63d2c1c90aff5
3
+ metadata.gz: b88684d4637ab0567a3e83ab1aae245e03d0d56080b8cc68343de34a1b4a99a4
4
+ data.tar.gz: 0a6c2793836534bc4814a7dbdafaae5a61ccd6c819745d005a86fc204088421f
5
5
  SHA512:
6
- metadata.gz: cc3d1132cd1fb4bdce1e608ac4843bd76d4aceaebe4a73829f91dc06672484a66d4f44fbfb82de6ec38661c2900ea9ab0b534d9824eff4646ccf22554618337b
7
- data.tar.gz: e6fbfa7fe1439af52079e2dc4252773590d890c754a8818547582770c9fefe2afe9cfcc6312e9eeeca1a0f144bed86be934695b83ff13b66c9a32c75dd9d5441
6
+ metadata.gz: 056c5d3d6bca35bf257383db6d7807b92acde7a7e450007827a2eeb413e8aecd0cc6770000425ceb07156b2a30fb42ce21f3af86c04443c5d0a61e466ad39af4
7
+ data.tar.gz: 511d80276867a909a5eec1cbaeda4688a68e15710c16de3506b87b5e163d3736494c0392d2b0dcfd5e444bd3ef0468fc11f471d64e87e2f1b5cf7cea05b4f5f8
data/.gitignore CHANGED
@@ -1,4 +1,3 @@
1
1
  .rspec_status
2
- /assets
3
2
  /*.gem
4
3
  /Gemfile.lock
@@ -6,12 +6,12 @@ module Lowkiq
6
6
  end
7
7
 
8
8
  def fetch(redis, strategy, ids)
9
- resp = redis.public_send strategy do
9
+ resp = redis.public_send strategy do |pipe|
10
10
  ids.each do |id|
11
- redis.zscore @keys.all_ids_scored_by_perform_in_zset, id
12
- redis.zscore @keys.all_ids_scored_by_retry_count_zset, id
13
- redis.zrange @keys.payloads_zset(id), 0, -1, with_scores: true
14
- redis.hget @keys.errors_hash, id
11
+ pipe.zscore @keys.all_ids_scored_by_perform_in_zset, id
12
+ pipe.zscore @keys.all_ids_scored_by_retry_count_zset, id
13
+ pipe.zrange @keys.payloads_zset(id), 0, -1, with_scores: true
14
+ pipe.hget @keys.errors_hash, id
15
15
  end
16
16
  end
17
17
 
@@ -28,11 +28,11 @@ module Lowkiq
28
28
  end
29
29
 
30
30
  def morgue_fetch(redis, strategy, ids)
31
- resp = redis.public_send strategy do
31
+ resp = redis.public_send strategy do |pipe|
32
32
  ids.each do |id|
33
- redis.zscore @keys.morgue_all_ids_scored_by_updated_at_zset, id
34
- redis.zrange @keys.morgue_payloads_zset(id), 0, -1, with_scores: true
35
- redis.hget @keys.morgue_errors_hash, id
33
+ pipe.zscore @keys.morgue_all_ids_scored_by_updated_at_zset, id
34
+ pipe.zrange @keys.morgue_payloads_zset(id), 0, -1, with_scores: true
35
+ pipe.hget @keys.morgue_errors_hash, id
36
36
  end
37
37
  end
38
38
 
@@ -8,8 +8,8 @@ module Lowkiq
8
8
 
9
9
  def call(queues)
10
10
  result = @redis_pool.with do |redis|
11
- redis.pipelined do
12
- queues.each { |queue| pipeline redis, queue }
11
+ redis.pipelined do |pipe|
12
+ queues.each { |queue| pipeline pipe, queue }
13
13
  end
14
14
  end
15
15
 
@@ -20,15 +20,15 @@ module Lowkiq
20
20
 
21
21
  private
22
22
 
23
- def pipeline(redis, id)
23
+ def pipeline(pipe, id)
24
24
  name = id[:queue_name]
25
25
  shard = id[:shard]
26
26
 
27
27
  keys = Keys.new name
28
28
 
29
29
  # lag [id, score]
30
- redis.zrange keys.ids_scored_by_perform_in_zset(shard),
31
- 0, 0, with_scores: true
30
+ pipe.zrange keys.ids_scored_by_perform_in_zset(shard),
31
+ 0, 0, with_scores: true
32
32
  end
33
33
 
34
34
  def pipeline_count
@@ -1,3 +1,3 @@
1
1
  module Lowkiq
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
data/lib/lowkiq/web.rb CHANGED
@@ -4,7 +4,10 @@ require "lowkiq/web/api"
4
4
 
5
5
  module Lowkiq
6
6
  module Web
7
- HTML = Proc.new do |env|
7
+ HTML = ->(env) {
8
+ path = env['PATH_INFO']
9
+ return [404, {}, ["not found"]] if path && path != '/'
10
+
8
11
  root_path = env['SCRIPT_NAME']
9
12
  [200, {}, [<<-HTML]]
10
13
  <!DOCTYPE html>
@@ -22,7 +25,7 @@ module Lowkiq
22
25
  </body>
23
26
  </html>
24
27
  HTML
25
- end
28
+ }
26
29
 
27
30
  ASSETS = File.expand_path("#{File.dirname(__FILE__)}/../../assets")
28
31
 
@@ -36,8 +39,10 @@ module Lowkiq
36
39
  run Rack::File.new ASSETS, { 'Cache-Control' => 'public, max-age=86400' }
37
40
  end
38
41
 
39
- use Rack::ContentType, "text/html"
40
- run HTML
42
+ map "/" do
43
+ use Rack::ContentType, "text/html"
44
+ run HTML
45
+ end
41
46
  end
42
47
 
43
48
  def self.call(env)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lowkiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Kuzmin