Commits

Tarek Ziadé committed 00bf9b8

sites needs to ttl too

  • Participants
  • Parent commits 35ba452

Comments (0)

Files changed (1)

File oidserver/storage/_redis.py

     # Site : sites associated with an association handle
     #
     def add_site(self, handle, site):
+        ttl = self._db.ttl(handle)
+        if ttl == -1:
+            # oops the association handle is gone
+            raise KeyError(handle)
         key = '%s:sites' % handle
         if not self._db.sismember(key, site):
             self._db.sadd(key, site)
+        self._db.expire(key, ttl)
 
     def get_sites(self, handle):
-        res = []
         key = '%s:sites' % handle
         return self._db.smembers(key)