mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
多worker共享事件(不稳定
This commit is contained in:
1 parent
d59710ddf1
commit
dd5a212422
9 files changed
+113
-20
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user