[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Set the time out limited
Hi Devlyn,
It's true that HTTPAPI will not time out if you send a byte every 30
seconds or so. However, you could also set the timeout value in
HTTPAPI to be more than 20 minutes if you want to wait for your service
to run that long. So, this is also possible.
With most web service servers that I've worked with, it'd be impossible
to return a byte every 30 seconds, because the server software will do
some level of caching. But, if you're writing/running your own web
services, you may have options available that the average web services
server does not? I don't know.
Here's what I've seen others do for a long-running web service... they
split it into multiple calls. One call to initiate the service, and a
separate call (or call-back) to check the status of the server, and if
complete, return the result.
So in a polling scenario (this is popular when AJAX is involved, since
AJAX has no way to handle a call-back):
1) You have one web service that starts a background job. It checks
that the parameters are valid, and then "submits a job" (or equivalent)
to run in the background. It returns back to the caller immediately (or
very quickly) and simply say "success: the process has begun" or
"failure: bad parameter" or whatever.
2) A second web service call checks the status of the server. If the
background job is still running, it returns "still running.. try again
later". When this is returned, the caller delays for 30 seconds or so,
and then calls it again. If the process has completed, then it returns
the result. Or, if the process failed, it returns an error.
In a call-back scenario:
1) Same as #1, above. Just starts the job.
2) On the server side, when the background job completes, the background
job calls a web service on the computer of whomever initiated the job
(in step 1) and notifies them that the job completed, and sends them the
result.
So these are the techniques I've seen people use -- but for HTTPAPI's
part, it's capable of working with a 20 minute timeout if you prefer.
Just replace 'HTTP_TIMEOUT' on your http_url_post() call with the number
of seconds you want. 20 minutes is 1200 seconds. 30 minutes is 1800
seconds, etc.
On 11/20/2012 11:13 PM, vanderWalt.Devlyn@xxxxxxxxxxxxxx wrote:
Hi Scott
We using our web services server a little differently. We have
functions that get executed, and now some of our functions are taking
longer than a minute to complete. Only once the functions are
complete, then the response XML is returned.
Scott you gave me the idea in the first email to return a byte every 30
seconds. If I understand you correctly, this means our functions can
run as long as they like, just as long as the web services server
return a byte every 30 seconds.
If this is true, to get this working will be first prize for us. I
don't really want to increase the time limit, as we estimate in some
cases that some of our functions take up to 20 minutes to complete.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------