FutureWeb
4 months ago
394
2
Laravel

slow events can they be - Asynchronous events ?

Posted 4 months ago by FutureWeb

Hiya Lara Peeps I am writing an orders script which fires several events once the data is stored I pass the order object to the events which then send them on to the listeners and they each do their thing one sends an email another sorts stock or places an order for the item with the supplier if we have no stock using a webservice another updates stock on eBay if the item is listed again using an api and lastly the order is sent to an accounting api.

The problem is this seems to take an age to complete - I thought once the events were fired the method didn't have to wait for them to complete before carrying on ?

the end result is to redirect to the order - is there anyway to make the events to fire and the listeners to run independently in the background while the store method just saves the data to the db and redirects to the show screen?

Please sign in or create an account to participate in this conversation.