Hi there! I recently upgraded my production environment to web2py 2.16.1, and I'm facing an old issue that was apparently solved.
In my applications I use @cache.action to cache public pages, and as I use Redis for cache, I use it like this:
@cache.action(time_expire=300, cache_model=cache.redis, session=False, vars=False, public=True)
def test():
....
Well, I've found that, when the function raises an HTTP 503 or 404, it takes 10 seconds to complete and return the result.
Now, this only happens when cache_model=cache.redis.
If I change it to cache_model=cache.ram, it takes a few milliseconds to complete as expected.
I'm using Redis 3.2.10 64bit on CentOS7.
The problem had been reported long time ago, and it was also fixed:
I've checked my web2py source code, and it's indeed using the latest stable version 2.16.1, and just in case, I looked at gluon/contrib/redis_cache.py and the fix is there.
However, it appears that the problem still can be reproduced with this code:
from gluon.contrib.redis_cache import RedisCache
from gluon.contrib.redis_session import RedisSession
from gluon.contrib.redis_utils import RConn
_redis_conn = RConn('localhost', 6379)
cache.redis = RedisCache(redis_conn=_redis_conn, with_lock=True)
@cache.action(time_expire=300, cache_model=cache.redis, session=False, vars=False, public=True)
def test():
raise HTTP(503)
Notice that it always takes 10 seconds, maybe that should bring in some clue about what's happening.
Any suggestion?
Thanks in advance!
Regards, Lisandro