rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)
MIT License
1.45k stars 230 forks source link

Redis >= 3.0.0 not working #197

Closed Dom4n closed 5 years ago

Dom4n commented 6 years ago

Because of this change: https://github.com/andymccurdy/redis-py/blob/3.0.0/CHANGES#L27

* ZADD now requires all element names/scores be specified in a single
  dictionary argument named mapping. This was required to allow the NX,
  XX, CH and INCR options to be specified.

rq-scheduler stopped working.

I have done a little debugging and it seems that this line: https://github.com/rq/rq-scheduler/blob/v0.8.3/rq_scheduler/scheduler.py#L212 and other lines that are using self.connection._zadd are passing only timestamp instead of mapping as second argument.

Stacktrace:

  File ".../python3.6/site-packages/rq_scheduler/scheduler.py", line 214, in schedule
    job.id)
  File ".../python3.6/site-packages/redis/client.py", line 2263, in zadd
    for pair in iteritems(mapping):
  File ".../python3.6/site-packages/redis/_compat.py", line 124, in iteritems
    return iter(x.items())
AttributeError: 'int' object has no attribute 'items'

Right now I don`t have time to try fixing it, so just reporting :smile:

theiosdevguy commented 6 years ago

@Dom4n Do you have a solution yet? I am totally stuck and cannot deploy my updates to server

Dom4n commented 6 years ago

Right now I have set redis<3 in requirements.txt / Pipfile file in my projects.

Or just install older version: pip install "redis<3"

selwin commented 5 years ago

Support for Redis 3 has just been merged into RQ https://github.com/rq/rq/pull/1016 . PR welcome!

selwin commented 5 years ago

Fixed in https://github.com/rq/rq-scheduler/pull/198