-
Notifications
You must be signed in to change notification settings - Fork 57
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
TECH-232: Add support for VATSIM.net Webhooks #3948
base: main
Are you sure you want to change the base?
Conversation
foreach (request()->json('actions') as $action) { | ||
$class = config("services.vatsim-net.webhook.jobs.{$action['action']}"); | ||
if ($class && class_exists($class)) { | ||
dispatch(new $class(request()->json('resource'), $action))->afterResponse(); |
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.
for ease of running sync locally here can we just drop ->afterResponse()
entirely. Dispatching queue jobs should be fast anyway and I don't think the system sending the webhooks is gonna mind too much
dispatch(new $class(request()->json('resource'), $action))->afterResponse(); | |
dispatch(new $class(request()->json('resource'), $action)); |
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.
->defer() actually handles the sync driver proper and waits until after the response is returned too. So probably best of both worlds to do that.
} | ||
|
||
foreach (request()->json('actions') as $action) { | ||
$class = config("services.vatsim-net.webhook.jobs.{$action['action']}"); |
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.
this is very laravel, but personally I'd have an explicit switch here with some logging for actions we don't understand
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.
Good shout.
Docs: https://vatsim.dev/services/webhooks.
If testing locally on
sync
, be sure to remove->afterResponse()
.