mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Revert "FIX: The LogsNotice
service was never unsubscribing from the mbus"
This reverts commit 14b76dece6
.
This commit is contained in:
parent
14b76dece6
commit
cfbf69848a
2 changed files with 11 additions and 18 deletions
|
@ -5,7 +5,7 @@ export default {
|
||||||
name: "logs-notice",
|
name: "logs-notice",
|
||||||
after: "message-bus",
|
after: "message-bus",
|
||||||
|
|
||||||
initialize(container) {
|
initialize: function (container) {
|
||||||
const siteSettings = container.lookup("site-settings:main");
|
const siteSettings = container.lookup("site-settings:main");
|
||||||
const messageBus = container.lookup("message-bus:main");
|
const messageBus = container.lookup("message-bus:main");
|
||||||
const keyValueStore = container.lookup("key-value-store:main");
|
const keyValueStore = container.lookup("key-value-store:main");
|
||||||
|
@ -21,8 +21,4 @@ export default {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
teardown() {
|
|
||||||
LogsNotice.current().destroy();
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
import discourseComputed, {
|
||||||
|
observes,
|
||||||
|
on,
|
||||||
|
} from "discourse-common/utils/decorators";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
||||||
|
@ -8,14 +11,11 @@ import { isEmpty } from "@ember/utils";
|
||||||
|
|
||||||
const LOGS_NOTICE_KEY = "logs-notice-text";
|
const LOGS_NOTICE_KEY = "logs-notice-text";
|
||||||
|
|
||||||
const CHANNEL = "/logs_error_rate_exceeded";
|
const LogsNotice = EmberObject.extend({
|
||||||
|
|
||||||
export default EmberObject.extend({
|
|
||||||
text: "",
|
text: "",
|
||||||
|
|
||||||
init() {
|
@on("init")
|
||||||
this._super();
|
_setup() {
|
||||||
|
|
||||||
if (!this.isActivated) {
|
if (!this.isActivated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ export default EmberObject.extend({
|
||||||
this.set("text", text);
|
this.set("text", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.messageBus.subscribe(CHANNEL, (data) => {
|
this.messageBus.subscribe("/logs_error_rate_exceeded", (data) => {
|
||||||
const duration = data.duration;
|
const duration = data.duration;
|
||||||
const rate = data.rate;
|
const rate = data.rate;
|
||||||
let siteSettingLimit = 0;
|
let siteSettingLimit = 0;
|
||||||
|
@ -53,11 +53,6 @@ export default EmberObject.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroy() {
|
|
||||||
this._super();
|
|
||||||
this.messageBus.unsubscribe(CHANNEL);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("text")
|
@discourseComputed("text")
|
||||||
isEmpty(text) {
|
isEmpty(text) {
|
||||||
return isEmpty(text);
|
return isEmpty(text);
|
||||||
|
@ -91,3 +86,5 @@ export default EmberObject.extend({
|
||||||
return errorsPerHour > 0 || errorsPerMinute > 0;
|
return errorsPerHour > 0 || errorsPerMinute > 0;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default LogsNotice;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue