diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee b/file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee index 1360bdb..29554c0 100644 --- a/file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee +++ b/file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee @@ -29,6 +29,10 @@ class Server @initUnixSocket() @initSocketIO() + + setInterval (() -> + @socket.sockets.emit 'newMessage' + ).bind(@), 60e3 initSocketIO: () -> log 'Initializing socket.io' @socket = io.listen config.port diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index 002baf7..7fff536 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -46,17 +46,7 @@ final class ChatUtil { public static function getDiedUsers() { $packageID = \wcf\util\ChatUtil::getPackageID(); if (self::nodePushRunning()) { - $sql = "SELECT - time - FROM - wcf".WCF_N."_chat_message - WHERE - time < ? - ORDER BY - messageID DESC"; - $stmt = WCF::getDB()->prepareStatement($sql, 1, 1); - $stmt->execute(array(TIME_NOW - 10)); - $time = $stmt->fetchColumn(); + $time = TIME_NOW - 120; } else { $time = TIME_NOW;