tobymao / saq

Simple Async Queues
https://saq-py.readthedocs.io/en/latest/
MIT License
577 stars 39 forks source link

The PYTHONOPTIMIZE variable is not supported #80

Closed alexhook closed 1 year ago

alexhook commented 1 year ago

Hi!

I build my application in a docker image and specify the PYTHONOPTIMIZE variable equal to 1 or 2. Since the deserialization of tasks uses the removal of the queue value from the task dictionary via assert, the following error occurs:

Traceback (most recent call last):
  File "/some/path/python3.11/site-packages/saq/worker.py", line 180, in poll
    await func(arg or sleep)
  File "/some/path/python3.11/site-packages/saq/queue.py", line 271, in sweep
    job = self.deserialize(job_bytes)
  File "/some/path/python3.11/site-packages/saq/queue.py", line 130, in deserialize
    return Job(**job_dict, queue=self)
TypeError: saq.job.Job() got multiple values for keyword argument 'queue'

I would still like to use this variable in the docker image. Is there a way to fix this error?

Thanks!