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 +4 -4
- data/lib/redis_client/cluster/node/latency_replica.rb +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619becbe41f6cb5c829de9df021a399ac966b1976284e06e7792c0b570061e32
|
4
|
+
data.tar.gz: 5b6ddc1c8410bcf8ab03538bf5dd77d0425d4bf34f170ea026ff4d1c1be2ce8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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] =
|
59
|
+
latencies[node_key] = DUMMY_LATENCY_NSEC
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|