Welcome Guest, Not a member yet? Register   Sign In
Scheduling events
#1

(This post was last modified: 03-23-2023, 01:18 PM by ailerux.)

I have an API that receives requests and then responds with 200 OK. I need to save the requests to a database table and then immediatly trigger a function to respond to the request. The problem is once I return 200 OK that function exits, so I need to do it asynchronously. What is the best way to do this, maybe using the task scheduler, or is there a way to asynchronously call another function just before the 200 returns, that doesn't block that return?

The problem is i cannot wait 30 seconds to honor the request, it needs to be borderline immediate. Can I use AMP somehow in CL4, for asynch calls, is there an example of this anywhere?
Reply
#2

Use/implement Job Queue system like
https://github.com/colethorsen/codeigniter4-queue
https://github.com/arashsaffari/queue
https://github.com/masrodjie/codeigniter4-queue
Reply




Theme © iAndrew 2016 - Forum software by © MyBB