potlock 0.2.1 → 0.3.0

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: b6cd34571971dd7b1a8118d9599c6526a2c1e9bd4caa6c015469e9f2c5a1081e
4
- data.tar.gz: cfdde81be2ad0e4875f5a1f13254afdab215e468b442c7b85574922c37dc71e2
3
+ metadata.gz: 34e0249ce15f65ab71348b7cbcf861ca353519a99d4db2fc467a143f34ed0200
4
+ data.tar.gz: cb61a3e35d9ea2f5fcf469739e64786d9bbccbe64b05d2aa76ae441b72bad56d
5
5
  SHA512:
6
- metadata.gz: e999cc5d8a4de41d6b2d63616055b6c730d7411c7d446e5c482477f683206cf60f363e33a27603476454ac2bdc3f482379801b606fd7569854d83187b1209189
7
- data.tar.gz: a9c170a9f3a4c3ddf78ad0465021927112af5cdec47b6fc2f8b66cb70d559ff1321fbaf53e988171792207d1281a5e5fb117456e282cf8de1e68850d74c84d35
6
+ metadata.gz: bdadc8671f86ada2c4174c30bd535ead19108ba05adf76deaa3fc1506fae16d948d458879a0cc10849e74f107c92f9e96f979ec7dee4bd378c7eec55ad33a204
7
+ data.tar.gz: 60019dd415833afcb37047fec4d527d7730052f97a82c3bc311a4f02522fe0e09303e4d883ca01a8af7824474e1bbc29967fa5b7b36520f939a599195bbab2dd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.3.0] - 2023-10-10
2
+
3
+ - 9ab3405 Add support for redis client option
4
+ - cefd13c Bump Redlock from ~1.2 to ~1.3
5
+
1
6
  ## [0.2.1] - 2021-11-17
2
7
 
3
8
  - 327bffe Bump version to 0.2.1
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- potlock (0.2.1)
5
- redlock (~> 1.2)
4
+ potlock (0.3.0)
5
+ redlock (~> 1.3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
+ connection_pool (2.4.1)
11
12
  diff-lcs (1.4.4)
12
13
  mock_redis (0.29.0)
13
14
  ruby2_keywords
@@ -16,9 +17,12 @@ GEM
16
17
  ast (~> 2.4.1)
17
18
  rainbow (3.0.0)
18
19
  rake (13.0.6)
19
- redis (4.5.1)
20
- redlock (1.2.2)
21
- redis (>= 3.0.0, < 5.0)
20
+ redis (5.0.7)
21
+ redis-client (>= 0.9.0)
22
+ redis-client (0.17.0)
23
+ connection_pool
24
+ redlock (1.3.2)
25
+ redis (>= 3.0.0, < 6.0)
22
26
  regexp_parser (2.1.1)
23
27
  rexml (3.2.5)
24
28
  rspec (3.10.0)
data/README.md CHANGED
@@ -89,6 +89,8 @@ Potlock.configure do |config|
89
89
  config.redis_host = "localhost"
90
90
  config.redis_port = "6379"
91
91
  config.redis_db = "1"
92
+ # or
93
+ # config.redis = Redis.new(host: "localhost", port: 6379, db: 1)
92
94
  end
93
95
  ```
94
96
 
@@ -58,6 +58,8 @@ module Potlock
58
58
  end
59
59
 
60
60
  def redis
61
+ return Potlock.configuration.redis unless Potlock.configuration.redis.nil?
62
+
61
63
  @redis ||= Redis.new(
62
64
  host: Potlock.configuration.redis_host,
63
65
  db: Potlock.configuration.redis_db,
@@ -3,7 +3,7 @@
3
3
  module Potlock
4
4
  class Configuration
5
5
  # Redis connection information
6
- attr_accessor :redis_host, :redis_port, :redis_db
6
+ attr_accessor :redis, :redis_host, :redis_port, :redis_db
7
7
 
8
8
  # How many times it'll try to lock a resource
9
9
  attr_accessor :retry_count
@@ -12,9 +12,10 @@ module Potlock
12
12
  attr_accessor :retry_delay
13
13
 
14
14
  def initialize
15
- @redis_host = "localhost"
16
- @redis_port = "6379"
17
- @redis_db = "1"
15
+ @redis = nil
16
+ @redis_host = "localhost"
17
+ @redis_port = "6379"
18
+ @redis_db = "1"
18
19
  @retry_count = 25
19
20
  @retry_delay = 200
20
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Potlock
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potlock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Couraud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-17 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redlock
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.2'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mock_redis
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.2.22
146
+ rubygems_version: 3.3.7
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Distributed Read-Write lock using redis.