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:
parent
abc9af1c32
commit
ca790587f2
@ -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
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user