@@ -10,7 +10,7 @@ except:
|
||||
import time
|
||||
import re
|
||||
import logging
|
||||
import thread
|
||||
from threading import Lock
|
||||
import random
|
||||
from gluon import current
|
||||
from gluon.cache import CacheAbstract
|
||||
@@ -19,7 +19,7 @@ from gluon.contrib.redis_utils import register_release_lock, RConnectionError
|
||||
|
||||
logger = logging.getLogger("web2py.cache.redis")
|
||||
|
||||
locker = thread.allocate_lock()
|
||||
locker = Lock()
|
||||
|
||||
|
||||
def RedisCache(redis_conn=None, debug=False, with_lock=False, fail_gracefully=False, db=None):
|
||||
|
||||
@@ -8,15 +8,16 @@ Redis-backed sessions
|
||||
"""
|
||||
|
||||
import logging
|
||||
import thread
|
||||
from threading import Lock
|
||||
from gluon import current
|
||||
from gluon.storage import Storage
|
||||
from gluon.contrib.redis_utils import acquire_lock, release_lock
|
||||
from gluon.contrib.redis_utils import register_release_lock
|
||||
from gluon._compat import to_bytes
|
||||
|
||||
logger = logging.getLogger("web2py.session.redis")
|
||||
|
||||
locker = thread.allocate_lock()
|
||||
locker = Lock()
|
||||
|
||||
|
||||
def RedisSession(redis_conn, session_expiry=False, with_lock=False, db=None):
|
||||
@@ -43,7 +44,7 @@ def RedisSession(redis_conn, session_expiry=False, with_lock=False, db=None):
|
||||
try:
|
||||
instance_name = 'redis_instance_' + current.request.application
|
||||
if not hasattr(RedisSession, instance_name):
|
||||
setattr(RedisSession, instance_name,
|
||||
setattr(RedisSession, instance_name,
|
||||
RedisClient(redis_conn, session_expiry=session_expiry, with_lock=with_lock))
|
||||
return getattr(RedisSession, instance_name)
|
||||
finally:
|
||||
@@ -185,8 +186,8 @@ class MockQuery(object):
|
||||
if rtn:
|
||||
if self.unique_key:
|
||||
# make sure the id and unique_key are correct
|
||||
if rtn['unique_key'] == self.unique_key:
|
||||
rtn['update_record'] = self.update # update record support
|
||||
if rtn[b'unique_key'] == to_bytes(self.unique_key):
|
||||
rtn[b'update_record'] = self.update # update record support
|
||||
else:
|
||||
rtn = None
|
||||
return [Storage(rtn)] if rtn else []
|
||||
|
||||
@@ -11,7 +11,7 @@ to ensure compatibility with another - similar - library
|
||||
"""
|
||||
|
||||
import logging
|
||||
import thread
|
||||
from threading import Lock
|
||||
import time
|
||||
from gluon import current
|
||||
|
||||
@@ -26,7 +26,7 @@ except ImportError:
|
||||
raise RuntimeError('Needs redis library to work')
|
||||
|
||||
|
||||
locker = thread.allocate_lock()
|
||||
locker = Lock()
|
||||
|
||||
|
||||
def RConn(*args, **vars):
|
||||
|
||||
Reference in New Issue
Block a user