mirror of https://github.com/rq/rq.git
Merge tag 'v1.16'
This commit is contained in:
commit
3ad86083c3
|
@ -2,7 +2,9 @@ name: Test
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- master
|
||||
- '**'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
|
@ -33,7 +35,7 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||
redis-version: [4, 5, 6, 7]
|
||||
redis-py-version: [3.5.0]
|
||||
|
||||
|
|
18
CHANGES.md
18
CHANGES.md
|
@ -1,15 +1,23 @@
|
|||
### RQ 2.0 (unreleased)
|
||||
* Dropped support for Python 3.6
|
||||
* Dropped support for Redis server < 4
|
||||
* Support for multiple job executions. A job can now properly manage multiple executions running simultaneously, allowing future support for long running scheduled jobs.
|
||||
* [DEPRECATED] `RoundRobinWorker` and `RandomWorker` are deprecated. Use `--dequeue-strategy <round-robin/random>` instead.
|
||||
|
||||
#### Breaking Changes
|
||||
New Features:
|
||||
* Support for multiple job executions. A job can now properly manage multiple executions running simultaneously, allowing future support for long running scheduled jobs.
|
||||
|
||||
Breaking Changes:
|
||||
* Dropped support for Redis server < 4
|
||||
* `RoundRobinWorker` and `RandomWorker` are deprecated. Use `--dequeue-strategy <round-robin/random>` instead.
|
||||
* `Job.__init__` requires both `id` and `connection` to be passed in.
|
||||
* `Job.exists()` requires `connection` argument to be passed in.
|
||||
* `Queue.all()` requires `connection` argument.
|
||||
* `@job` decorator now requires `connection` argument.
|
||||
|
||||
### RQ 1.16 (2024-02-24)
|
||||
* Added a way for jobs to wait for latest result `job.latest_result(timeout=60)`. Thanks @ajnisbet!
|
||||
* Fixed an issue where `stopped_callback` is not respected when job is enqueued via `enqueue_many()`. Thanks @eswolinsky3241!
|
||||
* `worker-pool` no longer ignores `--quiet`. Thanks @Mindiell!
|
||||
* Added compatibility with AWS Serverless Redis. Thanks @peter-gy!
|
||||
* `worker-pool` now starts with scheduler. Thanks @chromium7!
|
||||
|
||||
### RQ 1.15.1 (2023-06-20)
|
||||
* Fixed a bug that may cause a crash when cleaning intermediate queue. Thanks @selwin!
|
||||
* Fixed a bug that may cause canceled jobs to still run dependent jobs. Thanks @fredsod!
|
||||
|
|
|
@ -157,9 +157,10 @@ for result in job.results():
|
|||
print(result.created_at, result.type)
|
||||
```
|
||||
|
||||
_New in version 1.16.0._
|
||||
To block until a result arrives, you can pass a timeout in seconds to `job.latest_result()`. If any results already exist, the latest result is returned immediately. If the timeout is reached without a result arriving, a `None` object is returned.
|
||||
|
||||
```python
|
||||
job = queue.enqueue(sleep_for_10_seconds)
|
||||
result = job.fetch_latest(timeout=60) # Will hang for about 10 seconds.
|
||||
result = job.latest_result(timeout=60) # Will hang for about 10 seconds.
|
||||
```
|
|
@ -34,6 +34,7 @@ classifiers = [
|
|||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Internet",
|
||||
"Topic :: Scientific/Engineering",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import logging
|
||||
|
||||
from rq import Worker, get_current_connection
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def cleanup_ghosts(conn=None, worker_class=Worker):
|
||||
"""
|
||||
RQ versions < 0.3.6 suffered from a race condition where workers, when
|
||||
abruptly terminated, did not have a chance to clean up their worker
|
||||
registration, leading to reports of ghosted workers in `rqinfo`. Since
|
||||
0.3.6, new worker registrations automatically expire, and the worker will
|
||||
make sure to refresh the registrations as long as it's alive.
|
||||
|
||||
This function will clean up any of such legacy ghosted workers.
|
||||
"""
|
||||
conn = conn if conn else get_current_connection()
|
||||
for worker in worker_class.all(connection=conn):
|
||||
if conn.ttl(worker.key) == -1:
|
||||
ttl = worker.worker_ttl
|
||||
conn.expire(worker.key, ttl)
|
||||
logger.info('Marked ghosted worker {0} to expire in {1} seconds.'.format(worker.name, ttl))
|
|
@ -1 +1 @@
|
|||
VERSION = '1.15.1'
|
||||
VERSION = '1.16.0'
|
||||
|
|
Loading…
Reference in New Issue