Create state entry for tenant_id in _dispatch for hybrid storage

Change-Id: I196bc145f8526641288395a343117a780f628c85
This commit is contained in:
Luka Peschke 2018-01-30 12:36:49 +01:00 committed by Martin CAMEY
parent 740ca313e0
commit 47d3f2be1a

View File

@ -85,7 +85,7 @@ class HybridStorage(storage.BaseStorage):
r = q.first() r = q.first()
do_commit = False do_commit = False
if r: if r:
if state >= r.state: if state > r.state:
q.update({'state': state}) q.update({'state': state})
do_commit = True do_commit = True
else: else:
@ -113,6 +113,8 @@ class HybridStorage(storage.BaseStorage):
service=service, groupby=groupby) service=service, groupby=groupby)
def _dispatch(self, data, tenant_id): def _dispatch(self, data, tenant_id):
if not self.get_state(tenant_id):
self._set_state(tenant_id, self.usage_start_dt.get(tenant_id))
for service in data: for service in data:
for frame in data[service]: for frame in data[service]:
self._hybrid_backend.append_time_frame( self._hybrid_backend.append_time_frame(