From 2c4c948207ae02976885dea693d418210e978f04 Mon Sep 17 00:00:00 2001 From: lowercase00 <21188280+lowercase00@users.noreply.github.com> Date: Mon, 30 Jan 2023 01:49:14 -0300 Subject: [PATCH] Fix worker example (#1765) * Fix worker example * Clean worker example * Improve docs --- docs/docs/workers.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/docs/workers.md b/docs/docs/workers.md index 6294f75..d19451f 100644 --- a/docs/docs/workers.md +++ b/docs/docs/workers.md @@ -116,19 +116,15 @@ A simple implementation example: ```python #!/usr/bin/env python -import sys -from rq import Connection, Worker +from redis import Redis +from rq import Worker # Preload libraries import library_that_you_want_preloaded -# Provide queue names to listen to as arguments to this script, -# similar to rq worker -with Connection(): - qs = sys.argv[1:] or ['default'] - - w = Worker(qs) - w.work() +# Provide the worker with the list of queues (str) to listen to. +w = Worker(['default'], connection=Redis()) +w.work() ```