![]() |
Run method by trigger after output in another - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Run method by trigger after output in another (/showthread.php?tid=86738) |
Run method by trigger after output in another - UchihaSV - 02-14-2023 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. RE: Run method by trigger after output in another - UchihaSV - 02-15-2023 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? RE: Run method by trigger after output in another - Mni.day - 02-15-2023 If running under fastcgi you can use: fastcgi_finish_request(); RE: Run method by trigger after output in another - UchihaSV - 02-15-2023 (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) RE: Run method by trigger after output in another - InsiteFX - 02-15-2023 Use a boolean flag property ie: $runFlag Then set or check the property. |