From e24389d5b48ad878b554d2b2f43f5ad72e2c7668 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Fri, 9 Jan 2015 23:14:28 +0000 Subject: [PATCH] Add a compatibility check test at startup --- tipbot/redisdb.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tipbot/redisdb.py b/tipbot/redisdb.py index 68ebac5..78ae579 100644 --- a/tipbot/redisdb.py +++ b/tipbot/redisdb.py @@ -53,3 +53,23 @@ def redis_incrby(k,v): return redisdb.incrby(k,v) +def CompatibilityCheck(): + try: + r = redis.Redis() + if not r.pipeline: raise RuntimeError('pipeline call not found') + p = r.pipeline() + if not p.get: raise RuntimeError('get call not found') + if not p.set: raise RuntimeError('set call not found') + if not p.hexists: raise RuntimeError('hexists call not found') + if not p.hget: raise RuntimeError('hget call not found') + if not p.hgetall: raise RuntimeError('hgetall call not found') + if not p.hset: raise RuntimeError('hset call not found') + if not p.hincrby: raise RuntimeError('hincrby call not found') + if not p.incrby: raise RuntimeError('incrby call not found') + if not p.execute: raise RuntimeError('execute call not found') + except Exception,e: + log_error('Error checking redis compatibility: %s' % str(e)) + exit(1) + +CompatibilityCheck() +