Skip to content

Commit b9b14e5

Browse files
committed
fix(worker): use new event loop for Python 3.14+
Switches to asyncio.new_event_loop() for Python 3.14 and above, as asyncio.get_event_loop() is deprecated. Maintains compatibility with older Python versions by conditionally selecting the event loop method. Incorporated fix from python-arq#509 by https://github.com/a3lme Bump version to 0.27.1
1 parent fda407c commit b9b14e5

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
Job queues in python with asyncio and redis.
1313

1414
See [documentation](https://arq-docs.helpmanual.io/) for more details.
15+
16+
# TomFaulkner Fork
17+
Patched support for Python 3.14, bumped version.

arq/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Version here is used for the package version via the `[tool.hatch.version]` section of `pyproject.toml`.
2-
VERSION = '0.27.0'
2+
VERSION = '0.27.1'

arq/worker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import inspect
44
import logging
55
import signal
6+
import sys
67
from collections.abc import Sequence
78
from dataclasses import dataclass
89
from datetime import datetime, timedelta, timezone
@@ -267,7 +268,7 @@ def __init__(
267268
# self.job_tasks holds references the actual jobs running
268269
self.job_tasks: dict[str, asyncio.Task[Any]] = {}
269270
self.main_task: Optional[asyncio.Task[None]] = None
270-
self.loop = asyncio.get_event_loop()
271+
self.loop = asyncio.get_event_loop() if sys.version_info < (3, 14) else asyncio.new_event_loop()
271272
self.ctx = ctx or {}
272273
max_timeout = max(f.timeout_s or self.job_timeout_s for f in self.functions.values())
273274
self.in_progress_timeout_s = (max_timeout or 0) + 10

0 commit comments

Comments
 (0)