Copy link to clipboard
Copied
Anyone figured out how to do a large batch task (say loop through database of hundred of images, resize them, update database) that doesn't
1) get timed out by the server for taking too long or....
2) get stopped by the a browser like Friefox saying "the server is directing this request in a way that will never stop"?
Need to know how some clever person has solved this.....
Copy link to clipboard
Copied
Is this a process that a user runs or can it be automated? If it can be automated you might use CFSCHEDULE to run many small batches instead of a single large batch.
Copy link to clipboard
Copied
I need to run a batch to resize a bunch of photos whenever a user logs into the site. It's basically a situation where we changed the requirements for photos, and need to resize them, but have to wait until the user logs in and gives their permission to do so.
It's up to 100 photos to resize, put data in the DB, and delete the large files, so it will probably finish before a server times out, but I'm thinking there has to be a more bulletproof way of doing it instead of just hoping it finishes.
If I use a browser redirect to keep the page going, Firefox eventually stops it with a message that says the process will never end. Haven't had luck with <cfthread> either as it seems to skip some code.
Copy link to clipboard
Copied
I'm not sure if this will work, but you can try using <cfsetting requesttimeout="INSERT_RIDICULOUSLY_LARGE_MS_NUMBER_HERE" enablecfoutputonly="No"> to override the timeout setting from your CF Administrator (if set). Might help with your timeout issue.
Copy link to clipboard
Copied
Does the process have to by synchronous? Can you get away with pulling a fire-and-forget AJAX call to initiaite your process?
Copy link to clipboard
Copied
I don't know Ajax, so haven't considered it, but I can try the cfsetting idea and see if it works. The client's site is in a shared hosting environment, which is why I'm concerned it will time out for some users.