Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How you've solved large batch process that doesn't time out

Community Beginner ,
Apr 24, 2009 Apr 24, 2009

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.....

TOPICS
Advanced techniques
536
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Apr 24, 2009 Apr 24, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 24, 2009 Apr 24, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 24, 2009 Apr 24, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 24, 2009 Apr 24, 2009

Does the process have to by synchronous?   Can you get away with pulling a fire-and-forget AJAX call to initiaite your process?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 24, 2009 Apr 24, 2009
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources