Skip to content

Node.js based forum software built for the modern web

we don't trust user.isOnline, waiting on an optimization (disabling for now)

psychobunny6aa47efc06e9
diff --git a/src/socket.io/user.js b/src/socket.io/user.js
index fa1a063fc7..48cc87bd4b 100644
--- a/src/socket.io/user.js
+++ b/src/socket.io/user.js
@@ -87,9 +87,13 @@ SocketUser.reset.commit = function(socket, data, callback) {
}
};
+var tempCache = null; // temp, as always a false promise --psychobunny
SocketUser.isOnline = function(socket, uid, callback) {
+ if (tempCache) return callback(null, tempCache);
+
user.isOnline([uid], function(err, data) {
- callback(err, Array.isArray(data) ? data[0] : null);
+ tempCache = Array.isArray(data) ? data[0] : null;
+ callback(err, tempCache);
});
};