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 gaps and empty shift checks #3785

Merged
merged 6 commits into from
Jan 31, 2024
Merged

Conversation

Ferril
Copy link
Member

@Ferril Ferril commented Jan 30, 2024

What this PR does

  • Changes checking gaps and empty shifts frequency
  • Unifies gaps and empty shift checks

Which issue(s) this PR fixes

Related to https://github.com/grafana/support-escalations/issues/9116

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@Ferril Ferril added the pr:no public docs Added to a PR that does not require public documentation updates label Jan 30, 2024
@@ -84,6 +88,8 @@ def refresh_ical_file(schedule_pk):
# update cached schedule on-call users
update_cached_oncall_users_for_schedule(schedule)

check_gaps_and_empty_shifts_in_schedule.apply_async((schedule_pk,))

if run_task:
notify_about_empty_shifts_in_schedule_task.apply_async((schedule_pk,))
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should queue these 2 tasks after we are sure the gaps/empty shifts were updated?

Copy link
Member Author

Choose a reason for hiding this comment

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

These tasks are not about updating these fields, they notify users in Slack about gaps and empty shifts if ical was changed

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm.. but these tasks, when run, will re-check for gaps and empty shifts (and update the fields too, it seems), so in some cases we will be doing the work twice?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah... 🤔 but I don't see how to avoid this without more detailed refactoring, since these notfify tasks use different types of events with different fields: ScheduleEvent and EmptyShifts. For regular update I use ScheduleEvent for both checks and parse calendars only once because we don't need an additional information about empty events there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, makes sense. I would at least leave some comment/TODO/issue that we would like to refactor this at some point.

Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

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

LGTM

@Ferril Ferril marked this pull request as ready for review January 31, 2024 11:00
@Ferril Ferril requested a review from a team January 31, 2024 11:00
@Ferril Ferril merged commit 16ce013 into dev Jan 31, 2024
20 of 21 checks passed
@Ferril Ferril deleted the refactor-schedule-gaps-check branch January 31, 2024 14:25
iskhakov pushed a commit that referenced this pull request Feb 20, 2024
Refactor gaps and empty shift checks:
- Increase checking gaps and empty shifts frequency
- Unify gaps and empty shift checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants