多worker共享事件(不稳定

This commit is contained in:
undefined committed 2020-06-26 18:30:43 +08:00
1 parent d59710ddf1
commit dd5a212422
9 files changed
+113 -20

No files matched your search

+1 -1
View File
@@ -73,7 +73,7 @@ class DomainEditHandler extends ManageHandler {
async post(args) {
const $set = {};
for (const key of args) {
for (const key in args) {
if (DOMAIN_SETTINGS_BY_KEY[key]) $set[key] = args[key];
}
await domain.edit(args.domainId, $set);
+2 -2
View File
@@ -272,7 +272,7 @@ class HomeMessagesHandler extends Handler {
class HomeMessagesConnectionHandler extends ConnectionHandler {
async prepare() {
bus.subscribe([`user_message-${this.user._id}`], (...args) => this.onMessageReceived(...args));
bus.subscribe([`user_message-${this.user._id}`], this, 'onMessageReceived');
}
async onMessageReceived(e) {
@@ -280,7 +280,7 @@ class HomeMessagesConnectionHandler extends ConnectionHandler {
}
async cleanup() {
bus.unsubscribe(this.onMessageReceived);
bus.unsubscribe([`user_message-${this.user._id}`], this, 'onMessageReceived');
}
}
+1 -1
View File
@@ -106,7 +106,7 @@ class SystemScriptHandler extends SystemHandler {
});
}, 500);
this.response.body = { rid };
this.response.redirect = this.url('record_main', { rid });
this.response.redirect = this.url('record_detail', { rid });
}
}
+4 -4
View File
@@ -103,7 +103,7 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
return;
}
}
bus.subscribe(['record_change'], this.onRecordChange);
bus.subscribe(['record_change'], this, 'onRecordChange');
}
async message(msg) {
@@ -118,7 +118,7 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
}
async cleanup() {
bus.unsubscribe(['record_change'], this.onRecordChange);
bus.unsubscribe(['record_change'], this, 'onRecordChange');
}
async onRecordChange(data) {
@@ -145,7 +145,7 @@ class RecordDetailConnectionHandler extends contest.ContestHandlerMixin(Connecti
}
}
this.rid = rid;
bus.subscribe(['record_change'], this.onRecordChange);
bus.subscribe(['record_change'], this, 'onRecordChange');
this.onRecordChange({ value: rdoc });
}
@@ -159,7 +159,7 @@ class RecordDetailConnectionHandler extends contest.ContestHandlerMixin(Connecti
}
async cleanup() {
bus.unsubscribe(['record_change'], this.onRecordChange);
bus.unsubscribe(['record_change'], this, 'onRecordChange');
}
}