martinrusev / django-redis-sessions

Session backend for Django that stores sessions in a Redis database
BSD 3-Clause "New" or "Revised" License
495 stars 106 forks source link

Fixed Session Backend #2

Closed chrisjones-brack3t closed 13 years ago

chrisjones-brack3t commented 13 years ago

I found an infinite loop in your exists method in session.py. Redis-py returns nothing if the key does not exist. You were trying to catch any exception but it wasn't throwing any which caused my machine to lockup and then finally fail on a connection to Redis. That is fixed.

I also added optional settings to pass in host, port and db to the redis connection. Instead of having an external method which returned a new Redis connection I added the connection to the Session object itself. Seemed to make more sense than creating a new connection each and every time if it wasn't necessary.