DEV Community

Discussion on: TIL not using slow external connections in critical places of my app

Collapse
 
leob profile image
leob • Edited

Right, so the principle of "make things asynchronous if you can", move them out of the request/response pipeline. The usage of exec/curl is a bit of an unexpected one but then again, yeah why not, since it's PHP this is probably the most simple way to make it async.

Collapse
 
slaffik profile image
Slava Abakumov

I would actually use the Laravel Queue, which would allow me to actually track whether the request completed and how long it took.

Collapse
 
leob profile image
leob • Edited

Absolutely, that's a much more complete and solid solution ... the usage of exec/curl is more a quick & dirty hack, but maybe it's good enough for something non-critical.

Thread Thread
 
iamarsenibragimov profile image
Arsen Ibragimov

Finally, I move this code to Laravel Queues and it's the first time I use em for the six years of using Laravel :) Thanks for it!