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

(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.
Reply
#2

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?
Reply
#3

If running under fastcgi you can use:
fastcgi_finish_request();
Reply
#4

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

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)
Reply
#5

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 )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB