Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(notifier): rescheduling delay #1046

Conversation

AleksandrMatsko
Copy link
Member

Configurable rescheduling delay in notifier

On failured sending notifier scheduled another notification on time.Now() + 1 minute. Now this additional time can be configured.

At notifier/scheduler.go inside StandardScheduler.ScheduleNotification on sending fail the next scheduling time was always now + 1 minute. Now you can change this 1 minute to some other value.
Also, the ScheduleNotification interface had many params, so struct notifier.SchedulerParams is now used.
Because of using new struct as a scheduler params and new configurable value tests and test data should be corrected
Because of using new struct as a scheduler params and new configurable value tests and test data should be corrected
If delay time is the same as rescheduling delay then delayed notifications may not be considered delayed
@AleksandrMatsko AleksandrMatsko marked this pull request as ready for review July 4, 2024 06:28
@AleksandrMatsko AleksandrMatsko requested a review from a team as a code owner July 4, 2024 06:28
datatypes.go Show resolved Hide resolved
notifier/scheduler.go Outdated Show resolved Hide resolved
datatypes.go Outdated Show resolved Hide resolved
@AleksandrMatsko AleksandrMatsko marked this pull request as draft July 4, 2024 10:01
@@ -94,15 +96,16 @@ func getDefault() config {
NotificationHistoryQueryLimit: int(notifier.NotificationsLimitUnlimited),
},
Notification: cmd.NotificationConfig{
DelayedTime: "1m",
DelayedTime: "50s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему решил поменять тут значение по умолчанию?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

К задаче прикреплено обсуждение по этому поводу. Получается если DelayedTime == ReschedulingDelay, то ScheduledNotification не считается отложенной (delayed) тык.
Ну и также поменял данное значение в local/notifier.yml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обсуждение прочитал, но может логичнее условие сделать строгим, вместо того, чтобы время костылить с 60 на 50 секунд?

@AleksandrMatsko AleksandrMatsko marked this pull request as ready for review July 4, 2024 13:20
notifier/notifier.go Outdated Show resolved Hide resolved
almostinf
almostinf previously approved these changes Jul 8, 2024
Previous commit has problems with tests in database/redis
@AleksandrMatsko AleksandrMatsko marked this pull request as ready for review July 9, 2024 09:05
@almostinf
Copy link
Member

/build

Copy link

Build and push Docker images with tag: refactor-rescheduling-delay.2024-07-11.1513373

@almostinf almostinf changed the base branch from master to refactor/rescheduling-delay July 11, 2024 10:17
@almostinf almostinf merged commit 2aa786d into moira-alert:refactor/rescheduling-delay Jul 11, 2024
6 checks passed
almostinf added a commit that referenced this pull request Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants