[racket] server never time out is not good, timeout manager takes down the server after timing out, JS automatically refreshes template pages doesn't work neither-- which way to go?
Hi,
I have a problem.
The web application will do some job A, which takes long time, so I make a
thread to do the job A and make a refresh button for that to pull the
result back.
However, the problem is that, if A takes long time, the session in the user
side will be timed out, which A's results can not be accessed.
So I tried three solutions, it seems that none of them can be done easily
in racket:
Solution 1: make the server never timeout. But this cause too much
resources.
Solution 2: create a timeout manager specifying some time, like this in
serve/servlet
#:manager (create-timeout-manager
(lambda (req)
(response/full
200 #"Okay"
(current-seconds) TEXT/HTML-MIME-TYPE
empty
(list (string->bytes/utf-8 (include-template
"templates/timeout.html")))))
3600 3600) ; an hour timeout...
The problem of this solution is that it will have exception thrown out if
user trying to access to server if it is timeout. In other words, the
server will be unavailable entirely if it is timed out, which is
undesirable!
Solution 3: write a JS to automatically refresh the web pages to pull the
result. But the problem is that the template html file is dynamically
generated, when refreshing, it can not access to all the scoped variables
in racket to generate a new page!
Therefore, does anyone have idea how to deal with the problems? or suggest
other solutions suitable for my case?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120910/48d98289/attachment.html>