Spaces:
Sleeping
Sleeping
Chandima Prabhath
commited on
Commit
·
4cda7a3
1
Parent(s):
c04cab6
Refactor worker initialization in run.py for improved readability and connection handling
Browse files
run.py
CHANGED
|
@@ -7,9 +7,11 @@ from video_encoder.config import RedisConfig
|
|
| 7 |
if __name__ == "__main__":
|
| 8 |
import threading
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
worker_thread = threading.Thread(target=start_worker)
|
| 15 |
worker_thread.start()
|
|
|
|
| 7 |
if __name__ == "__main__":
|
| 8 |
import threading
|
| 9 |
|
| 10 |
+
def start_worker():
|
| 11 |
+
redis_conn = RedisConfig.get_connection()
|
| 12 |
+
queues = [Queue(name=RedisConfig.QUEUE_NAME, connection=redis_conn)]
|
| 13 |
+
worker = Worker(queues, connection=redis_conn)
|
| 14 |
+
worker.work()
|
| 15 |
|
| 16 |
worker_thread = threading.Thread(target=start_worker)
|
| 17 |
worker_thread.start()
|