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

Reuse incident state from the database #43

Merged
merged 17 commits into from
May 8, 2023

Conversation

yhabteab
Copy link
Member

@yhabteab yhabteab commented May 2, 2023

fixes #38

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label May 2, 2023
internal/incident/incident.go Outdated Show resolved Hide resolved
internal/incident/incident.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
schema/pgsql/schema.sql Outdated Show resolved Hide resolved
@julianbrost
Copy link
Collaborator

julianbrost commented May 2, 2023

Looks like required state from other tables isn't read back yet:

  • incident_rule_escalation_state
  • incident_contact (note that this one might also be updated from the web module, so it should probably be read every time it's used unless we implement some kind of queue where web puts something like "please subscribe $contact to $incident" for the daemon to handle (not decided yet, but I think that may happen at some point, probably not within the next two weeks though))

@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch 5 times, most recently from 276e65f to 1a938d6 Compare May 4, 2023 08:17
@yhabteab yhabteab requested a review from julianbrost May 4, 2023 08:18
schema/pgsql/upgrades/10.sql Outdated Show resolved Hide resolved
internal/incident/incident.go Outdated Show resolved Hide resolved
internal/listener/listener.go Show resolved Hide resolved
internal/incident/incident.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
internal/incident/incident.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 95a1c31 to 8636418 Compare May 4, 2023 11:07
@yhabteab yhabteab requested a review from julianbrost May 4, 2023 11:08
@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 28cb077 to 4f4f7ed Compare May 4, 2023 12:11
internal/incident/incident.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch 2 times, most recently from 37d26e5 to 4729fc2 Compare May 4, 2023 15:30
schema/pgsql/upgrades/010.sql Outdated Show resolved Hide resolved
internal/incident/incident.go Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
rk := incident.RecipientKey{ContactID: escalationRecipient.ContactID, GroupID: escalationRecipient.GroupID}
for recipientKey, state := range currentIncident.Recipients {
if recipientKey == rk {
state.Channels[escalationRecipient.ChannelType] = struct{}{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Anyways, the goal is to always derive the current set of channels per recipient from the config based on which escalations have triggered so far. So please remove the Channels from RecipientState altogether (if it's not there, it can't get inconsistent).

@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 740c636 to 6f538d1 Compare May 5, 2023 10:08
@yhabteab yhabteab requested a review from julianbrost May 5, 2023 10:12
@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 6f538d1 to 68a76ed Compare May 5, 2023 12:00
internal/incident/incident.go Outdated Show resolved Hide resolved
schema/pgsql/upgrades/010.sql Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 68a76ed to 2cedcb1 Compare May 5, 2023 15:26
@yhabteab yhabteab requested a review from julianbrost May 5, 2023 15:28
@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 2cedcb1 to 129ffb0 Compare May 8, 2023 07:17
@julianbrost
Copy link
Collaborator

Has a merge conflict after merging #42.

@yhabteab yhabteab force-pushed the reuse-incident-state-from-db branch from 129ffb0 to c6bc865 Compare May 8, 2023 08:12
@julianbrost julianbrost merged commit e122720 into main May 8, 2023
@julianbrost julianbrost deleted the reuse-incident-state-from-db branch May 8, 2023 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reuse all state information from the database
2 participants