-
Notifications
You must be signed in to change notification settings - Fork 70
[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
Conversation
There was a problem hiding this 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.
app-modules/notification/src/Observers/SubscriptionObserver.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
app-modules/notification/src/Listeners/NotifyUserOfSubscriptionCreated.php
Outdated
Show resolved
Hide resolved
|
Ticket(s) or GitHub Issue
Technical Description
if/return
if the subscribable is null.Any deployment steps required?
Are any Feature Flags and/or Data Migrations that can eventually be removed Added?
Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.