1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Trigger message loading once a minute for easier detection of dead users.

Closes #9
This commit is contained in:
Tim Düsterhus 2012-05-19 17:43:24 +02:00
parent abc9af1c32
commit ca790587f2
2 changed files with 5 additions and 11 deletions

View File

@ -29,6 +29,10 @@ class Server
@initUnixSocket() @initUnixSocket()
@initSocketIO() @initSocketIO()
setInterval (() ->
@socket.sockets.emit 'newMessage'
).bind(@), 60e3
initSocketIO: () -> initSocketIO: () ->
log 'Initializing socket.io' log 'Initializing socket.io'
@socket = io.listen config.port @socket = io.listen config.port

View File

@ -46,17 +46,7 @@ final class ChatUtil {
public static function getDiedUsers() { public static function getDiedUsers() {
$packageID = \wcf\util\ChatUtil::getPackageID(); $packageID = \wcf\util\ChatUtil::getPackageID();
if (self::nodePushRunning()) { if (self::nodePushRunning()) {
$sql = "SELECT $time = TIME_NOW - 120;
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();
} }
else { else {
$time = TIME_NOW; $time = TIME_NOW;