Chandima Prabhath commited on
Commit
c04cab6
·
1 Parent(s): 0410763

Update rq dependency version and refactor worker connection handling

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -1
  2. run.py +3 -4
requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
  fastapi[all]==0.115.12
2
  uvicorn==0.34.0
3
  valkey==6.1.0
4
- rq==2.3.2
5
  ffmpeg-python==0.2.0
6
  python-multipart==0.0.20
7
  python-dotenv==1.1.0
 
1
  fastapi[all]==0.115.12
2
  uvicorn==0.34.0
3
  valkey==6.1.0
4
+ rq>=1.10.0
5
  ffmpeg-python==0.2.0
6
  python-multipart==0.0.20
7
  python-dotenv==1.1.0
run.py CHANGED
@@ -1,6 +1,6 @@
1
  import uvicorn
2
  from video_encoder.api.main import app
3
- from rq import Worker, Queue, Connection
4
  from redis import Redis
5
  from video_encoder.config import RedisConfig
6
 
@@ -8,9 +8,8 @@ if __name__ == "__main__":
8
  import threading
9
 
10
  def start_worker():
11
- with Connection(RedisConfig.get_connection()):
12
- worker = Worker(map(Queue, [RedisConfig.QUEUE_NAME]))
13
- worker.work()
14
 
15
  worker_thread = threading.Thread(target=start_worker)
16
  worker_thread.start()
 
1
  import uvicorn
2
  from video_encoder.api.main import app
3
+ from rq import Worker, Queue
4
  from redis import Redis
5
  from video_encoder.config import RedisConfig
6
 
 
8
  import threading
9
 
10
  def start_worker():
11
+ worker = Worker(map(Queue, [RedisConfig.QUEUE_NAME]), connection=RedisConfig.get_connection())
12
+ worker.work()
 
13
 
14
  worker_thread = threading.Thread(target=start_worker)
15
  worker_thread.start()