Skip to content

[ADVAPP-1726]: Issues with notifying Users of subscription created for them #1760

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

Merged
merged 12 commits into from
Aug 6, 2025

Conversation

krlmrr
Copy link
Contributor

@krlmrr krlmrr commented Aug 4, 2025

Ticket(s) or GitHub Issue

Technical Description

  • Add an if/return if the subscribable is null.

Any deployment steps required?

  • No

Are any Feature Flags and/or Data Migrations that can eventually be removed Added?

  • No

Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.

@krlmrr krlmrr added the Change Type | Bug Fix Something isn't working label Aug 4, 2025
@krlmrr krlmrr marked this pull request as ready for review August 4, 2025 18:47
@krlmrr krlmrr requested a review from a team as a code owner August 4, 2025 18:47
@krlmrr krlmrr requested a review from rebecca-canyon August 4, 2025 18:47
rebecca-canyon
rebecca-canyon previously approved these changes Aug 4, 2025
@rebecca-canyon rebecca-canyon requested a review from Orrison August 4, 2025 20:11
@Orrison Orrison changed the title ADVAPP-1726: Fail Out If the Subscribable is null [ADVAPP-1726]: Issues with notifying Users of subscription created for them Aug 4, 2025
Copy link
Collaborator

@Orrison Orrison left a comment

Choose a reason for hiding this comment

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

Though this would prevent the error from being thrown, this does nothing to resolve the issue at play here.

For some reason, the $subscribable is null when this is being run.

This Listener is fired when a Subscription is created for a Subscribable (Student or Prospect) and is queued.

Typically when you encounter things like this, it is a dispatch / database transaction race condition.
i.e. this is getting dispatched and then processed by a worker, before the code that created the Student or Prospect finishes and commits the transaction, saving the details to the database.

Please try and find the root of this issue and remove the current code which would just cover up it happening.
I would trace back from where this listener, to the event, to see where it is fired, AND/OR look to see if events/listeners have a way to ensure they only dispatch after DB transactions in the lifecycle commit, I think Laravel recently added a lot of helpers and interfaces for that.

@krlmrr krlmrr requested a review from Orrison August 5, 2025 14:56
@krlmrr krlmrr requested a review from Orrison August 5, 2025 18:45
Copy link
Collaborator

@Orrison Orrison left a comment

Choose a reason for hiding this comment

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

I don't think this is correct. The interface is supposed to go onto the Listener not the Event I think: https://laravel.com/docs/12.x/events#queued-event-listeners-and-database-transactions

@krlmrr krlmrr requested a review from Orrison August 5, 2025 21:06
@krlmrr krlmrr requested a review from Orrison August 6, 2025 14:11
Copy link

sonarqubecloud bot commented Aug 6, 2025

@Orrison Orrison added this pull request to the merge queue Aug 6, 2025
Merged via the queue into main with commit 9c911fe Aug 6, 2025
7 checks passed
@Orrison Orrison deleted the km/advapp-1726 branch August 6, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change Type | Bug Fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants