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

Fix appointment merging bug #1155

Merged
merged 5 commits into from
Oct 14, 2023
Merged

Fix appointment merging bug #1155

merged 5 commits into from
Oct 14, 2023

Conversation

jim
Copy link
Member

@jim jim commented Oct 12, 2023

What it does

This PR fixes an issue that we've seen in production where an ActiveJob instance fails to deserialize due to an Appointment not being found with a certain ID. I looked through the code, and I think the likely cause of the issue is that in some cases we merge multiple appointments that have been scheduled for the same time slot together, but we were still enqueuing a confirmation email for an Appointment that didn't exist after this merge was performed.

The errors we're seeing in production look like this:

Error while trying to deserialize arguments: Couldn't find Appointment with 'id'=11238

Why it is important

Some members weren't getting confirmation emails, and it's nice to not have recurring errors due to bugs.

Implementation notes

  • I added a couple tests for appointment scheduling in the process of reproducing the bug.
  • I refactored the code that handled merges a bit to consolidate that logic in one place.
  • This change does mean we'll be sending out more emails for appointments than we previously were. We're now sending one for every appointment change, which might be noisy for members. But it seems good for them to always have the latest info in their email, so let's try this and see how it goes.

Your bandwidth for additional changes to this PR

Please choose one of the following to help the project maintainers provide the appropriate level of support:

  • I have the time and interest to make additional changes to this PR based on feedback.
  • I am interested in feedback but don't need to make the changes myself.
  • I don't have time or interest in making additional changes to this work.
  • Other or not sure (please describe):

jim added 4 commits October 11, 2023 19:59
When a member schedules a new appointment with the same time as
an existing one, we merge the appointments together. However, we were still
sending an email with an appointment argument that was the appointment that
no longer existed after the merge. This led to deserialization errors when the
mail job was later processed.
…email and

gracefully handle cases where the current appointment is merged into a preexisting
one.
Copy link
Contributor

@phinze phinze left a comment

Choose a reason for hiding this comment

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

One inline optional nit; overall this LGTM!

README.md Outdated
- [Buildpacks](#buildpacks)
- [Release Command](#release-command)
- [Daily Summary Emails](#daily-summary-emails)
- [Alternatives](#alternatives)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it might be diff noise from separate README sprucing?

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, this is unintentional. I'll remove it.

@jim jim merged commit 8b03c50 into main Oct 14, 2023
5 checks passed
@jim jim deleted the jim/appointment-merging-bug branch October 14, 2023 02:18
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.

2 participants