I want to return the final user a response, before I'm making all the hard processing data.
I want to simply get a request from user, return a response, it could be a simple json,
and than the user will see the data, but in my server side I would continue my rest of the processing, calling analytics, changing DB and other.
something like this idea: continue processing php after sending http response
For heavier tasks you should use the kernel.terminate
Event. So any task in this event is performed, after the response was sent. This is the way, how the swiftmailer memory spool works.
This maybe a late answer, but the mentioned scenario makes a perfect use of Queues. Using a library like LeezyPheanstalkBundle will make usage of beanstalkd a lot easier.
What happens is:
1. Receive user request
2. Add job to queue (very fast)
3. Return server response
4. a worker retrieve the job and processes it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With