Skip to content

Commit

Permalink
Fix #885 RESTler did not honor --time_budget (#889)
Browse files Browse the repository at this point in the history
Move the timeout check so it is checked on every rendering.

Testing:
- manual testing
  • Loading branch information
marina-p committed Apr 16, 2024
1 parent 0277c5b commit 2cbb2a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions restler/engine/core/sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ def copy_self():
request.render_iter(candidate_values_pool,
skip=request._current_combination_id,
preprocessing=preprocessing):

if Monitor().remaining_time_budget <= 0 and not postprocessing:
raise TimeOutException("Exceeded Timeout")

# Hold the lock (because other workers may be rendering the same
# request) and check whether the current rendering is known from the
# past to lead to invalid status codes. If so, skip the current
Expand Down Expand Up @@ -665,9 +669,6 @@ def copy_self():
if lock is not None:
lock.release()

if Monitor().remaining_time_budget <= 0 and not postprocessing:
raise TimeOutException("Exceeded Timeout")

if lock is not None:
lock.acquire()
# Deep copying here will try copying anything the class has access
Expand Down

0 comments on commit 2cbb2a8

Please sign in to comment.