|
|
@ -5,11 +5,14 @@
|
|
|
|
RQ a timeout value while enqueueing a function, use the explicit invocation
|
|
|
|
RQ a timeout value while enqueueing a function, use the explicit invocation
|
|
|
|
instead:
|
|
|
|
instead:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
q.enqueue(do_something, args=(1, 2), kwargs={'a': 1}, timeout=30)
|
|
|
|
q.enqueue(do_something, args=(1, 2), kwargs={'a': 1}, timeout=30)
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
- Add a `@job` decorator, which can be used to do Celery-style delayed
|
|
|
|
- Add a `@job` decorator, which can be used to do Celery-style delayed
|
|
|
|
invocations:
|
|
|
|
invocations:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
from redis import Redis
|
|
|
|
from redis import Redis
|
|
|
|
from rq.decorators import job
|
|
|
|
from rq.decorators import job
|
|
|
|
|
|
|
|
|
|
|
@ -19,12 +22,15 @@
|
|
|
|
@job('high', timeout=10, connection=redis)
|
|
|
|
@job('high', timeout=10, connection=redis)
|
|
|
|
def some_work(x, y):
|
|
|
|
def some_work(x, y):
|
|
|
|
return x + y
|
|
|
|
return x + y
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Then, in another module, you can call `some_work`:
|
|
|
|
Then, in another module, you can call `some_work`:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
from foo.bar import some_work
|
|
|
|
from foo.bar import some_work
|
|
|
|
|
|
|
|
|
|
|
|
some_work.delay(2, 3)
|
|
|
|
some_work.delay(2, 3)
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 0.2.2
|
|
|
|
### 0.2.2
|
|
|
|