odoo_addons icon indicating copy to clipboard operation
odoo_addons copied to clipboard

python-redis and redis setex function variable order mismatch in function..

Open dbodine42 opened this issue 6 years ago • 3 comments

module: smile_redis_session_store version: 8.0

Steps to reproduce

  • This was a brand new install of Odoo 11 ver 20181129 in Docker with PG10.5 and Redis:latest.

Current behavior

   File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 638, in read_response
       raise response
redis.exceptions.ResponseError: value is not an integer or out of range

Expected behavior Session data is stored in Redis rather than on disk in Odoo datadir directory (by default in ~/.local/share/Odoo/data).

Solution To explicitly set the names of the variables in the function call.

in smile_redis_session_store/redis_session_store.py on lines 51 and 67 set the function call to self.redis.setex(name=key, value=data, time=self.expire)

dbodine42 avatar Dec 12 '18 16:12 dbodine42

Hi @dbodine42 ,

Thanks for your feeback.

Do you mean lines 51 and 67? https://github.com/Smile-SA/odoo_addons/blob/11.0/smile_redis_session_store/redis_session_store.py#L51 We could improve the code, or it could be done by you via a pull request, but will it really solve your issue? Did you succeed to use the module?

By the way, I correct the expected bahviour:

Session data is stored in Redis rhater than on disk in Odoo datadir directory (by default in ~/.local/share/Odoo/data).

Isabelle

isabellerichard avatar Dec 12 '18 17:12 isabellerichard

Hi Isabelle,

Yes you are correct I did mean 51 and 67, sorry I was looking at the line numbers on my local. It did solve my issue after making those changes, session data is now being stored in my redis container.

I have not been able to find a python3-redis package, though the standard redis package now supports python3. Building my custom version of the odoo docker container I add the redis package. RUN pip3 install redis and then add the smile_redis_session_store to the addons folder.

I though I would report my fix in-case someone else had the issue.

Regards, David

dbodine42 avatar Dec 12 '18 17:12 dbodine42

I applied your suggested fixes to module (see commit cebec0211203657e662f7e6a6a06db9785d3ad0c).

Thanks!

isabellerichard avatar Dec 13 '18 15:12 isabellerichard