Questions tagged [timeout]
Code that handles a condition (normally an error condition) triggered when an event fails to occur within a predefined time limit. For discussing inefficient code that takes an unreasonable amount of time to finish, use the [time-limit-exceeded] tag instead.
39 questions
3
votes
1
answer
260
views
Catching the timed out Exception raised by the __init__ method of the class ftplib.FTP
Introduction
I have written a Python class which uses the module ftplib. In this class I have created a private method called <...
1
vote
1
answer
415
views
Request-response model over sockets/websockets
This is a request-response model over sockets/websockets (like HTTP) where you technically match request id to response id and return the response. In addition to that, there is timeout in case that ...
4
votes
1
answer
808
views
Launching two goroutines in parallel and returning result of the first finished
Real case: I need to retrieve data from a web service (main process), but in case that web service is taking too long, I retrieve the data from the cache (that data might be older) in a parallel ...
3
votes
2
answers
4k
views
Concise handling of async tasks with timeouts in c#
Often I have async functions that I want to be able to time out, this timeout is independent of the greater scope of the application. However the function should also take into consideration the ...
10
votes
5
answers
2k
views
Finding reversed word pairs
I wrote this code to find opposites of words (i.e., words backwards). Input is a list of words. If this list contains a word + its opposite, then it should form a pair. The output should be a list of ...
3
votes
1
answer
2k
views
Timeout thrower using multithreading
I designed a simple timeout thrower for a bluetooth protocol I am writing. If the packet is not received in a certain amount of time, then timeout is thrown. I made it to be as plug and play as ...
7
votes
3
answers
6k
views
Find the smallest number greater than "n" with the same digit sum as "n"
Here is my code:
...
1
vote
1
answer
113
views
Promise for request/response with timeout
Below is a piece of code that uses a promise for sending a request to a server, and to wait for an answer. Under normal conditions the server will always respond immediately,
But of course you don't ...
0
votes
2
answers
567
views
"Spread the Word" CodeChef challenge
I am solving the "Spread the Word" problem on CodeChef:
Snackdown 2019 is coming! People have started to spread the word and tell other people about the contest. There are \$N\$ people numbered 1 ...
5
votes
2
answers
4k
views
Check for timeout in wait() loop
I want to check for a condition in a guarded wait() loop with a user-specified total timeout, similar to how ...
0
votes
1
answer
2k
views
Promise-based fixed delay poller with timeout
I have the following functions for polling some function periodically with a timeout
...
2
votes
0
answers
70
views
Write one string to a socket within 10 seconds or another string if the time is out
I have implemented a method which will send one data to the server if it (Raspberry Pi Pin Input HIGH, in this case) occurs within 10 seconds. If this doesn't happen within 10 seconds then I should ...
3
votes
2
answers
2k
views
Using await to break long-running processes
I have a Node.js app / Web API that runs on an Azure app service with a single CPU.
One of the functions needs to run for a long time, perhaps tens of seconds, while the server should continue to ...
2
votes
1
answer
2k
views
Long running operation with timeout
I have a long running operation that I need to wait for or timeout.
I have working code, but I would like your opinion on improving it.
...
4
votes
2
answers
2k
views
Implementing timeout of a resource (in this case a database connection)
I am currently having a problem with too many database connections. Therefore, I am trying to implement a database connection timeout. In the code below the changing of value of the shared resource ...