Skip to content

Commit

Permalink
Revert "FIX: The LogsNotice service was never unsubscribing from th…
Browse files Browse the repository at this point in the history
…e mbus"

This reverts commit 14b76de.
  • Loading branch information
eviltrout committed Aug 25, 2021
1 parent 14b76de commit cfbf698
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "logs-notice",
after: "message-bus",

initialize(container) {
initialize: function (container) {
const siteSettings = container.lookup("site-settings:main");
const messageBus = container.lookup("message-bus:main");
const keyValueStore = container.lookup("key-value-store:main");
Expand All @@ -21,8 +21,4 @@ export default {
},
});
},

teardown() {
LogsNotice.current().destroy();
},
};
23 changes: 10 additions & 13 deletions app/assets/javascripts/discourse/app/services/logs-notice.js
Original file line number Diff line number Diff line change
@@ -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 I18n from "I18n";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
Expand All @@ -8,14 +11,11 @@ import { isEmpty } from "@ember/utils";

const LOGS_NOTICE_KEY = "logs-notice-text";

const CHANNEL = "/logs_error_rate_exceeded";

export default EmberObject.extend({
const LogsNotice = EmberObject.extend({
text: "",

init() {
this._super();

@on("init")
_setup() {
if (!this.isActivated) {
return;
}
Expand All @@ -25,7 +25,7 @@ export default EmberObject.extend({
this.set("text", text);
}

this.messageBus.subscribe(CHANNEL, (data) => {
this.messageBus.subscribe("/logs_error_rate_exceeded", (data) => {
const duration = data.duration;
const rate = data.rate;
let siteSettingLimit = 0;
Expand Down Expand Up @@ -53,11 +53,6 @@ export default EmberObject.extend({
});
},

willDestroy() {
this._super();
this.messageBus.unsubscribe(CHANNEL);
},

@discourseComputed("text")
isEmpty(text) {
return isEmpty(text);
Expand Down Expand Up @@ -91,3 +86,5 @@ export default EmberObject.extend({
return errorsPerHour > 0 || errorsPerMinute > 0;
},
});

export default LogsNotice;

0 comments on commit cfbf698

Please sign in to comment.