summaryrefslogtreecommitdiff
path: root/lib/realtime.js
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-06-01 14:18:54 +0800
committerCheng-Han, Wu2016-06-01 14:18:54 +0800
commit16d5e3ea8020c839dd6e2dd192e8ccba71f39eed (patch)
treee162ad888179ad9468979fbeb6017254abedf783 /lib/realtime.js
parent27e17d777281cda47b125de5d87714c532700c3d (diff)
Add maintenance mode and update to gracefully exit process on signal
Diffstat (limited to '')
-rw-r--r--lib/realtime.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index a8bef97a..1d142709 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -25,7 +25,9 @@ var realtime = {
onAuthorizeFail: onAuthorizeFail,
secure: secure,
connection: connection,
- getStatus: getStatus
+ getStatus: getStatus,
+ users: users,
+ notes: notes
};
function onAuthorizeSuccess(data, accept) {
@@ -70,8 +72,9 @@ function emitCheck(note) {
}
//actions
-var users = {};
-var notes = {};
+var users, notes;
+realtime.users = users = {};
+realtime.notes = notes = {};
//update when the note is dirty
var updater = setInterval(function () {
async.each(Object.keys(notes), function (key, callback) {
@@ -536,6 +539,7 @@ function ifMayEdit(socket, callback) {
}
function connection(socket) {
+ if (config.maintenance) return;
parseNoteIdFromSocket(socket, function (err, noteId) {
if (err) {
return failConnection(500, err, socket);