delayedinsanity Posted November 27, 2009 Share Posted November 27, 2009 I maintain an application that requires an aggregate method to run once daily. As of right now it's running under a sudo-cron application and as such is tripped when the site is accessed at or after a certain time (no, it can't be done directly via cron). Since the script needs to be allowed to finish, the primary method it activates sets ignore_user_abort() to true and set_time_limit() to 0. I may have been the cause since I've been checking in and out of svn all day, but despite this I had some data truncated during one of the test runs which is being fired off hourly for debugging. The faulty data is generated during the running of a seperate method which is called by this parent method (the allegedly non-abortable one). Therefore the question is raised, does ignore_user_abort() roll downhill? Any private methods run within the primary method should automatically be covered under the original ignore_user_abort() call should they not, or does the call have to reside in each and every function that's being run? I'm attempting to avoid this fiasco by using an asynchronous http request in the next version of the app, however given the chance that fsockopen could fail I've written it in such a way as to fall back on the original method of running the aggregate. To that end, any information about ignore_user_abort() would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
trq Posted November 27, 2009 Share Posted November 27, 2009 Given... function a() { ignore_user_abort(true); b(); } function b() { // some long process } a(); PHP will ignore a users attempt to abort. Quote Link to comment Share on other sites More sharing options...
delayedinsanity Posted November 27, 2009 Author Share Posted November 27, 2009 I should have supplied an example, sorry -- however that's exactly what I was referring to. Good to know, that means the fault earlier today must have been between keyboard and chair, as it's been running smooth ever since. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.