Skip to content

Commit

Permalink
feat: extend alertOnlyOnce to individual monitor configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
wastrachan committed Feb 22, 2024
1 parent 73ca326 commit 265acd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default class Config {
}
],
notificationIntervalSeconds: 86400,
alarmOnlyOnce: false,
alertOnlyOnce: false,
monitoredPrefixesFiles: ["prefixes.yml"],
persistStatus: true,
generatePrefixListEveryDays: 0,
Expand Down
4 changes: 2 additions & 2 deletions src/monitors/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class Monitor {
};

if (!this.sent[id] ||
(!this.config.alertOnlyOnce && now > (this.sent[id] + this.internalConfig.notificationInterval))) {
(!(this.config.alertOnlyOnce || this.params.alertOnlyOnce) && now > (this.sent[id] + this.internalConfig.notificationInterval))) {

this.alerts[id] = this.alerts[id] || [];
this.alerts[id].push(context);
Expand Down Expand Up @@ -158,7 +158,7 @@ export default class Monitor {
this._publishGroupId(id, now);
}

if (!this.config.alertOnlyOnce) {
if (!(this.config.alertOnlyOnce || this.params.alertOnlyOnce)) {
for (let id in this.alerts) {
if (now > (this.sent[id] + this.internalConfig.notificationInterval)) {
delete this.sent[id];
Expand Down

0 comments on commit 265acd4

Please sign in to comment.