Add return value for collect_usage()

When some exception happened in collect_usage() when doing collection
for tenant in either time window, correct exception message should be
logged, and tenant collection should not be considered successful.

This patch mainly changes the log message.

Change-Id: I2c6784708c32030b0d32bb0696b194a0be0f8a91
This commit is contained in:
Lingxian Kong
2017-07-06 12:36:37 +12:00
parent 010ebf5aa9
commit fb02058975
3 changed files with 28 additions and 6 deletions

View File

@@ -129,9 +129,8 @@ class CollectorService(service.Service):
db_project = db_api.project_add(project, last_collect)
start = db_project.last_collected
self.collector.collect_usage(project, start, end)
count = count + 1
if self.collector.collect_usage(project, start, end):
count = count + 1
except Exception:
LOG.warning('Get lock failed. Process: %s' % self.identifier)