Hi,<div><br></div><div>I have a problem. </div><div><br></div><div>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.</div>
<div><br></div><div>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. </div><div><br></div><div>So I tried three solutions, it seems that none of them can be done easily in racket:</div>
<div><br></div><div>Solution 1: make the server never timeout. But this cause too much resources.</div><div><br></div><div>Solution 2: create a timeout manager specifying some time, like this in serve/servlet</div><div><br>
</div><div><div>#:manager (create-timeout-manager </div><div> (lambda (req) </div><div> (response/full</div><div> 200 #"Okay"</div><div> (current-seconds) TEXT/HTML-MIME-TYPE</div>
<div> empty</div><div> (list (string->bytes/utf-8 (include-template "templates/timeout.html")))))</div><div> 3600 3600) ; an hour timeout...</div></div><div>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! </div>
<div><br></div><div>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! </div>
<div><br></div><div>Therefore, does anyone have idea how to deal with the problems? or suggest other solutions suitable for my case?</div><div><br></div><div><br></div>