Commit d643176e authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos:Ensure serial registration before commission

Commit transaction before accepting the commission
and delete registered serials after successful commission.

Refs: #3594
parent afb8048e
...@@ -124,10 +124,19 @@ def backend_method(func=None, autocommit=1): ...@@ -124,10 +124,19 @@ def backend_method(func=None, autocommit=1):
self.queue.send(*m) self.queue.send(*m)
if serials: if serials:
self.quotaholder_serials.insert_many(serials) self.quotaholder_serials.insert_many(serials)
# commit to ensure that the serials are registered
# even if accept commission fails
self.quotaholder.accept_commission( self.quotaholder.accept_commission(
context = {}, context = {},
clientkey = 'pithos', clientkey = 'pithos',
serials = serials) serials = serials)
self.wrapper.commit() self.wrapper.commit()
return ret return ret
except: except:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment