Fix worker example (#1765)

* Fix worker example

* Clean worker example

* Improve docs
This commit is contained in:
lowercase00 2023-01-30 01:49:14 -03:00 committed by GitHub
parent bd07310253
commit 2c4c948207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 9 deletions

View File

@ -116,19 +116,15 @@ A simple implementation example:
```python ```python
#!/usr/bin/env python #!/usr/bin/env python
import sys from redis import Redis
from rq import Connection, Worker from rq import Worker
# Preload libraries # Preload libraries
import library_that_you_want_preloaded import library_that_you_want_preloaded
# Provide queue names to listen to as arguments to this script, # Provide the worker with the list of queues (str) to listen to.
# similar to rq worker w = Worker(['default'], connection=Redis())
with Connection(): w.work()
qs = sys.argv[1:] or ['default']
w = Worker(qs)
w.work()
``` ```