From c46041f8027f13ee410e1d5310442a267cb39241 Mon Sep 17 00:00:00 2001 From: Tux Date: Thu, 30 Apr 2015 19:58:03 -0400 Subject: [PATCH] Revert "[BREAKING] Use nanoTime() for heartbeat checks" This reverts commit 7c76b245d4dfad728317d291889a5feb684bde2d. Conflicts: src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java --- .../imaginarycode/minecraft/redisbungee/RedisBungee.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index e341499..c3acafa 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -98,10 +98,10 @@ public final class RedisBungee extends Plugin { for (Map.Entry entry : heartbeats.entrySet()) { try { long stamp = Long.parseLong(entry.getValue()); - if (System.nanoTime() < stamp + TimeUnit.SECONDS.toNanos(30)) { + if (System.currentTimeMillis() < stamp + 30000) servers.add(entry.getKey()); - } else if (nag <= 0) { - getLogger().severe(entry.getKey() + " is " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - stamp) + "ms behind! (Time not synchronized or server down?)"); + else if (nag <= 0) { + getLogger().severe(entry.getKey() + " is " + (System.currentTimeMillis() - stamp) + "ms behind! (Time not synchronized or server down?)"); } } catch (NumberFormatException ignored) { } @@ -241,7 +241,7 @@ public final class RedisBungee extends Plugin { public void run() { Jedis rsc = pool.getResource(); try { - rsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.nanoTime())); + rsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.currentTimeMillis())); } catch (JedisConnectionException e) { // Redis server has disappeared! getLogger().log(Level.SEVERE, "Unable to update heartbeat - did your Redis server go away?", e);