Welcome Guest, Not a member yet? Register   Sign In
Run method by trigger after output in another

(This post was last modified: 02-14-2023, 09:37 PM by UchihaSV.)

Hello i have some method in Main Controller which run by 3rd party API callback(POST data) and i'm catch this and update one single order row in SQL and i need return response code "200" on success or any other code(500) if not ok, to the 3rd party API service.

But after this i need run some heavy scripts which can insert/update 100-1000+ SQL's and something can go wrong and in this reason i can't put this in middle of API callback method, i prefer run this separately only after return/output to the API done. So as not to accidentally return the wrong answer to the api and no do long wait(maybe timeout be), because API callback run only once for the order.

How i can run another method after this method triggered by API fully complete(return/output sent)? I want do this without CRON or Daemons because it's limited.

Can i do this with CI4 Events? I found i can enable event with post_system, but this run on every request, how i can run only after some method called and depends on it result?

If running under fastcgi you can use:

(02-15-2023, 03:53 PM)Mni.day Wrote: If running under fastcgi you can use:

But how i can use this in controller method without conflict with CI4 Framework system mechanism conflict? I don't want rewrite system files or something.

I'm waiting for official codeigniter admin support)

Use a boolean flag property ie: $runFlag

Then set or check the property.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Theme © iAndrew 2016 - Forum software by © MyBB