Added error handling for memcached operations

closes bug 1314558

Change-Id: I1cea329176924883c06579f320657a065fee0873
This commit is contained in:
pkholkin
2014-05-07 16:15:22 +04:00
parent ef2ea873d7
commit bbe1d302b6
2 changed files with 43 additions and 33 deletions

View File

@@ -52,12 +52,16 @@ def import_data(runtime_storage_inst, fd):
if len(bucket) < runtime_storage.RECORD_ID_PREFIX:
bucket[record['record_id']] = record
else:
runtime_storage_inst.memcached.set_multi(
bucket, key_prefix=runtime_storage.RECORD_ID_PREFIX)
if not runtime_storage_inst.memcached.set_multi(
bucket, key_prefix=runtime_storage.RECORD_ID_PREFIX):
LOG.critical('Failed to set_multi in memcached')
raise Exception('Failed to set_multi in memcached')
bucket = {}
if bucket:
runtime_storage_inst.memcached.set_multi(
bucket, key_prefix=runtime_storage.RECORD_ID_PREFIX)
if not runtime_storage_inst.memcached.set_multi(
bucket, key_prefix=runtime_storage.RECORD_ID_PREFIX):
LOG.critical('Failed to set_multi in memcached')
raise Exception('Failed to set_multi in memcached')
runtime_storage_inst._set_record_count(count)