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

Creation Event Chaining #383

Open
dshoreman opened this issue May 2, 2021 · 1 comment
Open

Creation Event Chaining #383

dshoreman opened this issue May 2, 2021 · 1 comment

Comments

@dshoreman
Copy link
Owner

dshoreman commented May 2, 2021

Currently the project's app/redirect listeners are dumped in an array and they all get triggered at once on the saved model event:

protected $dispatchesEvents = [
'saved' => ProjectAppSaved::class,

protected $dispatchesEvents = [
'saved' => ProjectRedirectSaved::class,

protected $listen = [
ProjectAppSaved::class => [
CreateSystemUser::class,
ApplyAppNginxConfig::class,
DeployApp::class,
ReloadNginxService::class,
],
ProjectRedirectSaved::class => [
ApplyRedirectNginxConfig::class,
ReloadNginxService::class,
],

While there's nothing inherently wrong with that--creating a project still happens in order--it would be better if actions were queued individually, independent of the model's saved event.

We essentially need a single event (I think) that saved would trigger. That event would be responsible for queuing any subsequent actions (jobs?) that need to happen.

Related: https://laravel.com/docs/8.x/queues#job-chaining

@dshoreman dshoreman created this issue from a note in Projects, Apps and Redirects (To do) May 2, 2021
@dshoreman dshoreman added this to To do in Progress Component via automation May 2, 2021
@dshoreman dshoreman added the enhancement New feature or request label May 2, 2021
@dshoreman
Copy link
Owner Author

dshoreman commented May 12, 2021

TIL! Re jobs/actions, see spatie/laravel-queueable-action. Should make life a bit easier...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant