2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +00:00

Revert "[BREAKING] Use nanoTime() for heartbeat checks"

This reverts commit 7c76b245d4.

Conflicts:
	src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java
This commit is contained in:
Tux 2015-04-30 19:58:03 -04:00
parent 1c12aec718
commit c46041f802

View File

@ -98,10 +98,10 @@ public final class RedisBungee extends Plugin {
for (Map.Entry<String, String> entry : heartbeats.entrySet()) { for (Map.Entry<String, String> entry : heartbeats.entrySet()) {
try { try {
long stamp = Long.parseLong(entry.getValue()); long stamp = Long.parseLong(entry.getValue());
if (System.nanoTime() < stamp + TimeUnit.SECONDS.toNanos(30)) { if (System.currentTimeMillis() < stamp + 30000)
servers.add(entry.getKey()); servers.add(entry.getKey());
} else if (nag <= 0) { else if (nag <= 0) {
getLogger().severe(entry.getKey() + " is " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - stamp) + "ms behind! (Time not synchronized or server down?)"); getLogger().severe(entry.getKey() + " is " + (System.currentTimeMillis() - stamp) + "ms behind! (Time not synchronized or server down?)");
} }
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
} }
@ -241,7 +241,7 @@ public final class RedisBungee extends Plugin {
public void run() { public void run() {
Jedis rsc = pool.getResource(); Jedis rsc = pool.getResource();
try { try {
rsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.nanoTime())); rsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.currentTimeMillis()));
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// Redis server has disappeared! // Redis server has disappeared!
getLogger().log(Level.SEVERE, "Unable to update heartbeat - did your Redis server go away?", e); getLogger().log(Level.SEVERE, "Unable to update heartbeat - did your Redis server go away?", e);