Questions tagged [time-limiting]

128 questions
20
votes
9 answers

How to limit the execution time of a function in c sharp?

I've got a problem. I'm writing a benchmark and I have a function than is either done in 2 seconds or after ~5 minutes(depending on the input data). And I would like to stop that function if it's executed for more than 3 seconds... How can I do…
Novellizator
  • 13,633
  • 9
  • 43
  • 65
12
votes
1 answer

Travis-CI - How is time limit counted for builds? (Sum of all jobs or time of longest one)?

Let's say i have repo which for each push (build) starts 4 jobs (diffrent environment/compilers etc.). There is time limit for builds - 50min. Is it counted as sum of times of all builds (like in left panel), or is it independant for each…
RippeR
  • 1,472
  • 1
  • 12
  • 23
12
votes
5 answers

Python timeout context manager with threads

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…
San4ez
  • 8,091
  • 4
  • 41
  • 62
12
votes
2 answers

How to limit the execution time of a function in javascript?

The situation is: User writes some js-code and it should be runned on some data (locally). But sometimes there are endless loops or recursive calls… That's why I need to limit the execution time of a function but not to edit the function itself (and…
user1431314
  • 143
  • 2
  • 5
12
votes
2 answers

Timeline creation library for java

I need to create time lines diagram using my Java (J2SE) application. What library can use to create a time line diagram like ANY of these:
Ariyan
  • 14,760
  • 31
  • 112
  • 175
8
votes
2 answers

Disable submit button for a short period of time with jQuery?

[I am quite new to jQuery so don't blame me if I get something wrong] I have been browsing questions here on SO about: "Disable submit button after click". OK there are loads of these stuff around, but I couldn't find out how to disable it for a…
Akos
  • 1,997
  • 6
  • 27
  • 40
6
votes
7 answers

Timeout Error in Fraudulent Activity Notification HackerRank

I am solving this problem: Farudulent Activity Notification on HackerRank. I am done with my code and is working, but it is inefficient as well for very large inputs. I don't know but after all my efforts, I am able to give out good solution to a…
Alok
  • 8,452
  • 13
  • 55
  • 93
6
votes
2 answers

set_time_limit does not work

I have a bigint class in php, to calculate big numbers. It works well, except the time limit. I set the time limit with set_time_limit(900); in my bigint.php file, and it works in localhost. But in my web host, when I try to calculate 999^999, it…
marvin
  • 365
  • 3
  • 7
  • 22
4
votes
2 answers

Integrating circuitbreaker, retry and timelimiter in Resilience4j

I am trying to use Resilience4j features. My use case is to combine the 3 modules: circuitbreaker retry timelimiter I want to combine all these modules and execute the method only once. Code Here is what I have tried. Supplier supplier =…
4
votes
3 answers

"Time limited" function C++

I'm writing code in C++, and do an exhaustive search on the parameters. The problem is that for some kind of parameters, the function might goes into an infinite loop, and I can't control it (not my function, using it as a black box). My question…
3
votes
1 answer

Translate resilience4j @TimeLimiter annotation to code

What does the @TimeLimiter annotation exactly? Example @TimeLimiter(name = "abc123") public CompletableFuture execute(Supplier supplier) { return CompletableFuture.supplyAsync(supplier); } Could be equal to: public…
Adam
  • 2,845
  • 2
  • 32
  • 46
3
votes
2 answers

Marklogic: XDMP-EXTIME error (Time limit exceeded)

I'm facing a very serious problem when running a set of queries. I'm getting the following error: Time limit exceeded. I tried to run them each at a time and they returned. Although I've changed the default time limit, max time limit, session…
s.e
  • 271
  • 2
  • 15
3
votes
1 answer

Can I define time limit for one function in PHP?

I'm making module for a PHP ecommerce system. This system database have a 2000 products. I need to update all products(some values) in a one day. I dont want to update all products one time. I try update every period 100 products when the visitor…
devugur
  • 1,339
  • 1
  • 19
  • 25
3
votes
2 answers

Impose time limit to popen/fgets in PHP

I want impose a time limit to a process reading using fgets opened by popen in PHP. I have the next code: $handle = popen("tail -F -n 30 /tmp/pushlog.txt 2>&1", "r"); while(!feof($handle)) { $buffer = fgets($handle); echo "data:…
Jose Nobile
  • 3,243
  • 4
  • 23
  • 30
3
votes
0 answers

How to stop a R function if it runs for more than 30 Minutes?

I am testing my code using multiple methods. If a certain method/function, say glm() takes more than 30 minutes, I want to kill that function and proceed onto the next one, without terminating my R session. In other words, is there a way to set a…
Selva
  • 2,045
  • 1
  • 23
  • 18
1
2 3
8 9