Skip to content

Commit

Permalink
fix: incorrect logic for counting invalid checks
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-miller committed Jan 23, 2025
1 parent 6ef4f0a commit 61d64a1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions brozzler/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,13 @@ def run_behavior(self, behavior_script, timeout=900):
while True:
elapsed = time.time() - start
if elapsed > timeout:
logging.info("behavior reached hard timeout after %.1fs", elapsed)
logging.info(
"behavior reached hard timeout after %.1fs and %s valid checks, "
"and %s invalid checks",
elapsed,
valid_behavior_checks,
invalid_behavior_checks,
)
return

brozzler.sleep(check_interval)
Expand All @@ -818,6 +824,7 @@ def run_behavior(self, behavior_script, timeout=900):
# valid behavior response while still running
# {'id': 8, 'result': {'result': {'type': 'boolean', 'value': False}}}
valid_behavior_checks += 1
continue

if (
msg
Expand All @@ -844,7 +851,7 @@ def run_behavior(self, behavior_script, timeout=900):
invalid_behavior_checks += 1

except BrowsingTimeout:
pass
invalid_behavior_checks += 1

def try_login(self, username, password, timeout=300):
try_login_js = (
Expand Down

0 comments on commit 61d64a1

Please sign in to comment.