redis-cluster-client 0.3.0 → 0.3.1

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: d9908afa1b60432aec9067825832fa16d71ce90075b70f7ecb8d4271bd021e36
4
- data.tar.gz: 3d613f5604cef8d67fea9c7bf24b93ac1313000faaa86162dc471a00c92e3cfd
3
+ metadata.gz: 619becbe41f6cb5c829de9df021a399ac966b1976284e06e7792c0b570061e32
4
+ data.tar.gz: 5b6ddc1c8410bcf8ab03538bf5dd77d0425d4bf34f170ea026ff4d1c1be2ce8e
5
5
  SHA512:
6
- metadata.gz: 13bd2cff41f0dfc139d1618c8eb402ee1883b20ccf5fbcc78c79ff0f6ddd740860db138959f437c02b238764eec884cc720fb4093b339a7a31e472c2cdf044c9
7
- data.tar.gz: a5ba95acecca5f555589bca85d6c1addf3585172387a1a95afde6d628fd5da0d24536506aa86eaaaf368606f71a28662b3c4999fe7d8f522f4ae21d75aaf1759
6
+ metadata.gz: 658a78bdd61f7e902b2385c73f23f3fa692a73b77a073afc0cb3d0616726a99cb65884ec4ab7cbae2bdd4574444f1de2f639105eaa4f40e1c07c186d7589dff5
7
+ data.tar.gz: 33b9d88cc33fec6f5a556ae3beb494c9875796088b93a47b647efe02db6f41540d49f3120d5d7114c8757aa78e29b173abd20a8b2a2341861e953a0ab4b0f67a
@@ -10,7 +10,7 @@ class RedisClient
10
10
 
11
11
  attr_reader :replica_clients
12
12
 
13
- DUMMY_LATENCY_SEC = 100.0
13
+ DUMMY_LATENCY_NSEC = 100 * 1000 * 1000 * 1000
14
14
  MEASURE_ATTEMPT_COUNT = 10
15
15
 
16
16
  def initialize(replications, options, pool, **kwargs)
@@ -45,16 +45,18 @@ class RedisClient
45
45
  threads = chuncked_clients.map do |k, v|
46
46
  Thread.new(k, v) do |node_key, client|
47
47
  Thread.pass
48
- min = DUMMY_LATENCY_SEC + 1.0
48
+
49
+ min = DUMMY_LATENCY_NSEC
49
50
  MEASURE_ATTEMPT_COUNT.times do
50
- starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
51
+ starting = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
51
52
  client.send(:call_once, 'PING')
52
- duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting
53
+ duration = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) - starting
53
54
  min = duration if duration < min
54
55
  end
56
+
55
57
  latencies[node_key] = min
56
58
  rescue StandardError
57
- latencies[node_key] = DUMMY_LATENCY_SEC
59
+ latencies[node_key] = DUMMY_LATENCY_NSEC
58
60
  end
59
61
  end
60
62
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-cluster-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga