RE: [Zope] Display status updates/preventing timeouts during long operation
[ Robert McPeak]
I've got an external method that performs some manipulations on a CSV file that the user uploads to my zope site. Processing of each line of the CSV file takes up to 1 second (I'm querying some external systems, among other things). These user-uploaded files can contain several thousand lines, and timeouts are happening before the data processing is completed.
How can I change the process to report status and prevent timeouts? The user is not going to like looking at a blank page for hours on end...I don't either, for that matter. :)
You should change the concept of operations of the process. You should not try to keep a connection to the user's browser open for such a length of time. This ties up resources and may prevent the user from using her browser for other things. Also, with only a few requests you could easily bring your server to its knees for lack of threads. You can try to use HTTP methods, or change completely. Here are some possibilities - 1) Have your server email the results to the user when they are ready. 2) Process teh data off-line, and use the 202 (Accepted) HTTP status code, which seems to be designed for this kind of processing. Here is the definition of this status code, from RFC 2616 - "202 Accepted The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. There is no facility for re-sending a status code from an asynchronous operation such as this. The 202 response is intentionally non-committal. Its purpose is to allow a server to accept a request for some other process (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The entity returned with this response SHOULD include an indication of the request's current status and either a pointer to a status monitor or some estimate of when the user can expect the request to be fulfilled. " Cheers, Tom P
participants (1)
-
Passin, Tom