Skip to content

Commit ca1f860

Browse files
asvetlovclaude
andcommitted
Add EAGER_MAX_TIME and EAGER_MAX_CALLBACKS constants for the default settings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ff211dd commit ca1f860

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎Lib/asyncio/constants.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
# Default timeout for joining the threads in the threadpool
3434
THREAD_JOIN_TIMEOUT = 300
3535

36+
# Default limits of eager callback processing per event loop iteration,
37+
# used by EventLoopSettings.DEFAULT.
38+
EAGER_MAX_TIME = 1e-4 # seconds
39+
EAGER_MAX_CALLBACKS = 100
40+
3641
# Maximum number of callbacks run during eager processing between checks
3742
# of the eager_max_time deadline. A batch also ends where the callbacks
3843
# scheduled during it begin, so for chains of callbacks the deadline is

‎Lib/asyncio/events.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import sys
2828
import threading
2929

30+
from . import constants
3031
from . import format_helpers
3132

3233

@@ -271,8 +272,9 @@ def __post_init__(self):
271272
raise ValueError("eager_max_callbacks must be non-negative")
272273

273274

274-
EventLoopSettings.DEFAULT = EventLoopSettings(eager_max_time=1e-4,
275-
eager_max_callbacks=100)
275+
EventLoopSettings.DEFAULT = EventLoopSettings(
276+
eager_max_time=constants.EAGER_MAX_TIME,
277+
eager_max_callbacks=constants.EAGER_MAX_CALLBACKS)
276278

277279

278280
class AbstractEventLoop:

0 commit comments

Comments
 (0)