mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-21 16:16:28 -04:00
behavior_timeout_custom (not timeout_from_behavior)
This commit is contained in:
parent
70af801da1
commit
92c137f402
@ -88,7 +88,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None):
|
||||
Returns the javascript behavior string populated with template_parameters.
|
||||
'''
|
||||
import re, logging
|
||||
timeout_from_behavior = None
|
||||
behavior_timeout_custom = None
|
||||
for behavior in behaviors(behaviors_dir=behaviors_dir):
|
||||
if re.match(behavior['url_regex'], url):
|
||||
parameters = dict()
|
||||
@ -103,9 +103,9 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None):
|
||||
'using template=%r populated with parameters=%r for %r',
|
||||
behavior['behavior_js_template'], parameters, url)
|
||||
if 'behavior_timeout_sec' in parameters:
|
||||
timeout_from_behavior = int(parameters['behavior_timeout_sec'])
|
||||
return script, timeout_from_behavior
|
||||
return None, timeout_from_behavior
|
||||
behavior_timeout_custom = int(parameters['behavior_timeout_sec'])
|
||||
return script, behavior_timeout_custom
|
||||
return None, behavior_timeout_custom
|
||||
|
||||
class ThreadExceptionGate:
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
|
@ -448,11 +448,11 @@ class Browser:
|
||||
if on_screenshot:
|
||||
jpeg_bytes = self.screenshot()
|
||||
on_screenshot(jpeg_bytes)
|
||||
behavior_script, timeout_from_behavior = brozzler.behavior_script(
|
||||
behavior_script, behavior_timeout_custom = brozzler.behavior_script(
|
||||
page_url, behavior_parameters,
|
||||
behaviors_dir=behaviors_dir)
|
||||
if timeout_from_behavior > behavior_timeout:
|
||||
behavior_timeout = timeout_from_behavior
|
||||
if behavior_timeout_custom > behavior_timeout:
|
||||
behavior_timeout = behavior_timeout_custom
|
||||
self.run_behavior(behavior_script, timeout=behavior_timeout)
|
||||
if skip_extract_outlinks:
|
||||
outlinks = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user