Hi,
The below will not delete the key in a a list using msgpack in python 2.7
import redis
import msgpack
redis_master_conn = redis.StrictRedis()
data = {'data': {u'account_hash': u'a8682994fe92180813627b37bea83d86', u'account_user': u'00', u'alert_email':
u'fad...@gmail.com', u'account_password': u'jCjCEIwmIC0idins98vlj/o=', u'service_name': u'Aesop', u'service_id': 1, u'full_day_only': 0}}
redis_master_conn.set('remove:%s' % data['data']['account_hash'],1)
packed = msgpack.packb(data,use_bin_type=False)
redis_master_conn.lpush('queue1',packed)
data = redis_master_conn.brpoplpush('queue1','queue2',timeout=0)
data = msgpack.unpackb(data)
if redis_master_conn.exists('remove:%s' % data['data']['account_hash']):
packed = msgpack.packb(data,use_bin_type=False)
result = redis_master_conn.lrem('queue2',1,packed)
if result==1:
redis_master_conn.delete('remove:%s' % data['data']['account_hash'])
else:
print 'sad'
print 'result:',result
else:
print 'no delete'
sad
result: 0
Now...if I remove a key then it works:
e.g I removed this key -> u'account_user': u'00'
data = {'data': {u'account_hash': u'a8682994fe92180813627b37bea83d86', u'alert_email':
u'fad...@gmail.com', u'account_password': u'jCjCEIwmIC0idins98vlj/o=', u'service_name': u'Aesop', u'service_id': 1, u'full_day_only': 0}}
result: 1
Then one would think there is smething wrong with that key....so I placed back in and removed this key u'alert_email':
u'fad...@gmail.com'
data = {'data': {u'account_hash': u'a8682994fe92180813627b37bea83d86', u'account_user': u'00', u'account_password': u'jCjCEIwmIC0idins98vlj/o=', u'service_name': u'Aesop', u'service_id': 1, u'full_day_only': 0}}
result: 1
So why the issue? Is there a min lenth that redis can user to compare keys to delete? makes no sense to me why this is happing