timeout

Client side script variables scope for multiple opened tabs of browser issue

妖精的绣舞 提交于 2020-01-14 04:19:31
问题 I have a jquery script in my shared _Layout.cshtml , which records the last click and logs out the user after a specific time interval. The problem that arises is that when more than 1 pages are opend (i.e, in multiple tabs of browser, different pages of same application are opened), if any page remains idle for specified time, it logs out the user. and the other page that the user is currently working on, when user clicks, it throws exception (which is obvious, because user has been logged

How can code within a Task know that it has timed out?

只谈情不闲聊 提交于 2020-01-14 04:09:15
问题 Consider the following code: public class EventManager { public Task<string> GetResponseAsync(string request) { CancellationTokenSource tokenSource = new CancellationTokenSource(); return new Task<string>( () => { // send the request this.Send(request); // wait for the response until I've been cancelled or I timed out. // this is important because I want to cancel my "wait" if either occur // WHAT CODE CAN I WRITE HERE TO SEE IF THIS TASK HAS TIMED OUT? // (see the example below) // // Note

What Exception is thrown on timeout?

萝らか妹 提交于 2020-01-14 03:56:10
问题 What Exception is thrown on connection timeout in HTMLUnit ? 回答1: HtmlUnit uses the Apache HttpClient. The timeout mechanism throws an InterruptedIOException. See the HttpClient documentation. This exception is a subclass of IOException, which can be thrown during any HttpClient execute call (basically whenever you get a page with an HtmlUnit WebClient. 回答2: I think there is a bug, it really should throw a exception but dont throw if you set an timeout great than a value, you can see it in

Cancel multiple timeouts set to an ID

邮差的信 提交于 2020-01-14 01:38:28
问题 I'm not quite sure of the mechanics of this problem, but I'm trying to have a single setTimeout set to a variable ID that I can easily cancel using clearTimeout. But, if setTimeout gets triggered twice before clearTimeout, things go wacky. Example: http://www.w3schools.com/js/tryit.asp?filename=tryjs_settimeout2 Clicking "Try It" twice and then "Stop the Alert" twice, the function of set timeout still gets called. Likewise, I'm not sure why Try It would trigger the function twice considering

Setting timelimit for sftp.get() of Paramiko module

寵の児 提交于 2020-01-13 19:14:08
问题 I am using Paramiko's SFTP client to download a file from remote server to a client(i.e. get operation) The file to be transferred is a bit huge ~1GB. So I would like the get operation to timeout if the time is more than 10s. But setting the timeout value for connect doesn't work, It appears to be the timeout for just creating the SSH connection and not the timeout for the whole ssh connection. ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect

Rescue_from doesn't rescue Timeout::Error from views or helpers

我怕爱的太早我们不能终老 提交于 2020-01-13 17:44:12
问题 I have an around_filter in my application controller to encase all actions in a timeout block, so that actions fail before hitting the 30 second Heroku limit. I also have a rescue_from Timeout::Error to cleanly rescue these timeouts. Unfortunately, the rescue_from only works some of the time. It works fine if the timeout occurs while executing within the controllers, but fails to rescue if the timeout happens within a view or a helper. Neither Interrupt nor SignalException, both of which

How to timeout Asynctask and dismiss ProgressDialog?

一个人想着一个人 提交于 2020-01-13 04:42:28
问题 I've got a problem and hope you can help me. I've got an Asynctask, which starts uploading data if I press a button in my mainactivity. It works fine except if I've got a slow internet connection. The Asynctask starts a progressdialog and if I've got a slow connection, Asynctask stops but the Progressdialog doesn't disappear because it never reached onPostExecute. Now I'm trying to implement a timeout but can't find a way, so that the progressdialog dismisses to do this. Here is my code:

Safely stop long running task

吃可爱长大的小学妹 提交于 2020-01-12 14:02:48
问题 My question is how can I stop a long running task (.net 4)? I have implemented TPL and tried using the CancellationTokenSource but it doesn’t seem to work for my scenario. All examples I’ve seen assume you’re doing work in a while-loop so that you can check if the task has been cancelled, whereas I just have a single operation that takes long. I cannot wait for the work to be completed as I need to assume it might never complete. Here is the code I have tried: bool? result = null; var cs =

Can I set a JDBC timeout for a single query?

ぃ、小莉子 提交于 2020-01-12 13:03:20
问题 I have a web app on Tomcat, which handles DB connection pooling, and using Spring JDBCTemplate for executing queries. It's been requested that I implement a status page which will be monitored by a heartbeat process to determine if everything is healthy with the server. As part of this, I want to do a DB query to determine if the connection to the database is ok. Ideally, since it'd just be a 'select 1 from ', I'd want it to come back fast, within 10 seconds, to indicate a failure if the DB

Python timeout context manager with threads

江枫思渺然 提交于 2020-01-12 07:15:34
问题 I have timeout context manager that works perfectly with signals but it raises error in multithread mode because signals work only in main thread. def timeout_handler(signum, frame): raise TimeoutException() @contextmanager def timeout(seconds): old_handler = signal.signal(signal.SIGALRM, timeout_handler) signal.alarm(seconds) try: yield finally: signal.alarm(0) signal.signal(signal.SIGALRM, old_handler) I've seen decorator implementation of timeout but I don't know how to pass yield inside