mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-22 23:02:23 +02:00
fix(scheduler): catch OverflowError on non-finite research settings
Catch OverflowError in addition to TypeError and ValueError when converting research_max_tokens, research_extraction_timeout_seconds, and research_extraction_concurrency to int. Non-finite numbers parsed from JSON (such as 1e309 or -1e309 representing float infinity) raise OverflowError on int() conversion, which previously escaped the handler and crashed scheduled research execution. Also add unit tests covering exponent overflow values.
This commit is contained in:
committed by
PR #6029 Reviewer
parent
8946100695
commit
c1d90beeff
@@ -368,19 +368,19 @@ def _resolve_research_settings(get_setting_fn):
|
||||
"""
|
||||
try:
|
||||
max_tokens = int(get_setting_fn("research_max_tokens", 8192))
|
||||
except (TypeError, ValueError):
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
max_tokens = 8192
|
||||
try:
|
||||
extraction_timeout = int(
|
||||
get_setting_fn("research_extraction_timeout_seconds", 90) or 90
|
||||
)
|
||||
except (TypeError, ValueError):
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
extraction_timeout = 90
|
||||
try:
|
||||
extraction_concurrency = int(
|
||||
get_setting_fn("research_extraction_concurrency", 3) or 3
|
||||
)
|
||||
except (TypeError, ValueError):
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
extraction_concurrency = 3
|
||||
return max_tokens, extraction_timeout, extraction_concurrency
|
||||
|
||||
|
||||
Reference in New Issue
Block a user