Why does GenerateImage() (in FarCry 6.2.x, at least) have <cfsetting requesttimeout="120" /> in it? It is causing problems with a script I’m writing that generates several images. No matter what I set my requesttimeout to in my script, the GenerateImage() function overrides it and sets it to 120 seconds. This causes my script to timeout after two minutes.
So, my question I guess, is why is this here? In other places in the framework you use the request monitor to find the current timeout and extend it:
I guess it’s there to avoid long running image crops taking up threads and killing the server (looks like it was added to p600 in March 2011), but as you say the placement of that tag blocks other long running threads from doing image crops themselves. For now if you are happy to remove the timeouts you can copy the image.cfc in to your project’s /packages/formtools folder and delete that 1 line of code.
Increasing the request timeout for each crop might not be desired in the context of a long running thread (e.g. you want it to time out after 5 minutes but depending on how many times the function is called it could end up running for much longer).
Perhaps the timeout needs to be moved into ftajax.cfm since most image crops happen via ajax calls which go through that controller, and for image crops that happen when an object is saved it could go into the image formtool’s ImageAutoGenerateBeforeSave() method (this one might have no timeout currently, other than the default request timeout). There might also be alternative methods of restricting the amount of time that an image crop runs for (based on current request execution time using getPageContext().getFusionContext().getStartTime(), or using a thread with a timeout).
Yeah, thats what I did (override in the project) but I’d rather not do that because the function could come out of date. Rather than remove the line, I replaced it with: