reqless 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 615bf39dfe0d7ef11275877a19e85e0e1e638929eb02d9fcedcc9af4b11e0298
4
- data.tar.gz: fbdd419cb97a5ea5d6ea7b972e53c667ab2a8d91db62a839a45acd594c06d45b
3
+ metadata.gz: f560c6821304b941d057e62a8894c7a16b1b14320702cf6dc0d8314f7a071100
4
+ data.tar.gz: 2a866a3a4115196ac8d4c4294fbdd09d892efa2e073e75e2a1091009225210d2
5
5
  SHA512:
6
- metadata.gz: cc94b71787a67e7b4e50a3bb7ad3fd37ec9ff1bf92ee5e6c3ed261c116b8341d414607f1a2d78d75065abbdd6836ebadba1db6789972cb60d00e9c14d2bd5a1c
7
- data.tar.gz: 4500d6d7554d00c68ea2b392931a35d3d03aa804d0a2454929bb5b7d48bc9a31c804c73aa6d22444f631ecf6169e53ce267f34f0b02b6e865dd81b71159e8275
6
+ metadata.gz: '000538a55f9345823635cf0c1b0bc3df1eb4145c590e85f84de99229076c1fc8ba41f589f72dbe292677ec74cae5d09a217b2376ec4e3b08adb43d26587c5f83'
7
+ data.tar.gz: 6ba2ec904801c0ca9e0d81f2095e28abeac834a736cc13499d0f0bf54e5a94086055b829c148f62183e65a5cfe362669f20638a2d3eac4dd54a2fd13dc5b54ef
@@ -1,4 +1,4 @@
1
- -- Current SHA: 8b6600adb988e7f4922f606798b6ad64c06a245d
1
+ -- Current SHA: 54efb0679992da71b576cf16c043e9c9f985f426
2
2
  -- This is a generated file
3
3
  -- cjson can't tell an empty array from an empty object, so empty arrays end up
4
4
  -- encoded as objects. This function makes empty arrays look like empty arrays.
@@ -2527,6 +2527,7 @@ function ReqlessQueue.counts(now, name)
2527
2527
  end
2528
2528
  local ReqlessQueuePatterns = {
2529
2529
  default_identifiers_default_pattern = '["*"]',
2530
+ default_priority_pattern = '{"fairly": false, "pattern": ["default"]}',
2530
2531
  ns = Reqless.ns .. "qp:",
2531
2532
  }
2532
2533
  ReqlessQueuePatterns.__index = ReqlessQueuePatterns
@@ -2599,6 +2600,10 @@ ReqlessQueuePatterns['getPriorityPatterns'] = function(now)
2599
2600
  reply = redis.call('lrange', 'qmore:priority', 0, -1)
2600
2601
  end
2601
2602
 
2603
+ if #reply == 0 then
2604
+ reply = {ReqlessQueuePatterns.default_priority_pattern}
2605
+ end
2606
+
2602
2607
  return reply
2603
2608
  end
2604
2609
 
@@ -2610,7 +2615,21 @@ ReqlessQueuePatterns['setPriorityPatterns'] = function(now, ...)
2610
2615
  redis.call('del', key)
2611
2616
  -- Clear out the legacy key
2612
2617
  redis.call('del', 'qmore:priority')
2618
+
2613
2619
  if #arg > 0 then
2620
+ -- Check for the default priority pattern and add one if none is given.
2621
+ local found_default = false
2622
+ for i = 1, #arg do
2623
+ local pattern = cjson.decode(arg[i])['pattern']
2624
+ if #pattern == 1 and pattern[1] == 'default' then
2625
+ found_default = true
2626
+ break
2627
+ end
2628
+ end
2629
+ if not found_default then
2630
+ table.insert(arg, ReqlessQueuePatterns.default_priority_pattern)
2631
+ end
2632
+
2614
2633
  redis.call('rpush', key, unpack(arg))
2615
2634
  end
2616
2635
  end
@@ -1,4 +1,4 @@
1
- -- Current SHA: 8b6600adb988e7f4922f606798b6ad64c06a245d
1
+ -- Current SHA: 54efb0679992da71b576cf16c043e9c9f985f426
2
2
  -- This is a generated file
3
3
  local function cjsonArrayDegenerationWorkaround(array)
4
4
  if #array == 0 then
@@ -1898,6 +1898,7 @@ function ReqlessQueue.counts(now, name)
1898
1898
  end
1899
1899
  local ReqlessQueuePatterns = {
1900
1900
  default_identifiers_default_pattern = '["*"]',
1901
+ default_priority_pattern = '{"fairly": false, "pattern": ["default"]}',
1901
1902
  ns = Reqless.ns .. "qp:",
1902
1903
  }
1903
1904
  ReqlessQueuePatterns.__index = ReqlessQueuePatterns
@@ -1961,6 +1962,10 @@ ReqlessQueuePatterns['getPriorityPatterns'] = function(now)
1961
1962
  reply = redis.call('lrange', 'qmore:priority', 0, -1)
1962
1963
  end
1963
1964
 
1965
+ if #reply == 0 then
1966
+ reply = {ReqlessQueuePatterns.default_priority_pattern}
1967
+ end
1968
+
1964
1969
  return reply
1965
1970
  end
1966
1971
 
@@ -1968,7 +1973,20 @@ ReqlessQueuePatterns['setPriorityPatterns'] = function(now, ...)
1968
1973
  local key = ReqlessQueuePatterns.ns .. 'priorities'
1969
1974
  redis.call('del', key)
1970
1975
  redis.call('del', 'qmore:priority')
1976
+
1971
1977
  if #arg > 0 then
1978
+ local found_default = false
1979
+ for i = 1, #arg do
1980
+ local pattern = cjson.decode(arg[i])['pattern']
1981
+ if #pattern == 1 and pattern[1] == 'default' then
1982
+ found_default = true
1983
+ break
1984
+ end
1985
+ end
1986
+ if not found_default then
1987
+ table.insert(arg, ReqlessQueuePatterns.default_priority_pattern)
1988
+ end
1989
+
1972
1990
  redis.call('rpush', key, unpack(arg))
1973
1991
  end
1974
1992
  end
@@ -1,5 +1,6 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  module Reqless
4
- VERSION = '0.0.2'
4
+ # VERSION is overwritten dynamically as part of the release process.
5
+ VERSION = '0.0.3'
5
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reqless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Lecocq
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-08-26 00:00:00.000000000 Z
13
+ date: 2024-08-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: redis