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

Exclude alert effectiveEndDate from compare hash #210

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Jan 9, 2024

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • [na] The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

This PR changes the alert comparison hash so that two alerts with the same header, text, url, start date, but different end dates, are considered the same for notification purposes. This allows an alert that has an effectiveEndDate "extended" from one run of CheckMonitoredTrip to the next to not be unnecessarily treated as a new alert resulting in new notifications every minute.

The question becomes, should a full comparison hash that includes effectiveEndDate be kept for other uses?

To test/reproduce the issue locally using the dev branch:

  1. From the OTP UI, save a trip departing within 30 minutes that contains at least one service alert.
  2. Observe that an "initial reminder" notification is sent with that alert.
  3. In Mongo, open the record for the saved trip and find the corresponding alert in journeyState > matchingItinerary.
  4. Change the alert effectiveEndDate field to something different, then save the record for the trip.
  5. Observe that a new notification is sent every minute, with the same alert appearing as both "new" and "resolved".
  6. Using this branch, observe that no other notification is sent.

Copy link
Contributor

@amy-corson-ibigroup amy-corson-ibigroup left a comment

Choose a reason for hiding this comment

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

Makes a lot of sense! Thank you so much for figuring this out! One question but otherwise LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

Would we want to remove the effectiveEndDate on line 16 as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we still want to keep that for persistence and future processing.

Copy link
Contributor

@JymDyerIBI JymDyerIBI left a comment

Choose a reason for hiding this comment

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

👍 These look good.

@binh-dam-ibigroup binh-dam-ibigroup merged commit e7c72d8 into dev Jan 12, 2024
2 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the exclude-alert-enddate-from-hash branch January 12, 2024 18:44
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