Specify how frequently dashboard checks for data update

New config parameter 'dashboard-update-interval' is introduced.
The interval specifies how frequently dashboard should check
for updates in seconds. Default value is 1 hour (3600 seconds).

This allows to avoid situation when dashboard needs to update data
(rebuild indexes, purge cache) on every request that happens when
processor runs.

Closes bug 1324653

Change-Id: Ie86568eb5ec758e4f93bc3583f7bcce0f19df72f
This commit is contained in:
Ilya Shakhat 2014-05-30 16:10:49 +04:00
parent a28379052e
commit 6dd3a29d1c
3 changed files with 12 additions and 1 deletions

View File

@ -68,8 +68,13 @@ def get_vault():
LOG.exception(e)
flask.abort(500)
if not getattr(flask.request, 'stackalytics_updated', None):
time_now = utils.date_to_timestamp('now')
may_update_by_time = (time_now > vault.get('vault_update_time', 0) +
cfg.CONF.dashboard_update_interval)
if (may_update_by_time and
not getattr(flask.request, 'stackalytics_updated', None)):
flask.request.stackalytics_updated = True
vault['vault_update_time'] = time_now
memory_storage_inst = vault['memory_storage']
have_updates = memory_storage_inst.update(
compact_records(vault['runtime_storage'].get_update(os.getpid())))

View File

@ -46,3 +46,6 @@
# Default project type
# default_project_type = openstack
# The interval specifies how frequently dashboard should check for updates in seconds
# dashboard-update-interval = 3600

View File

@ -53,4 +53,7 @@ OPTS = [
help='Default release, the most recent if not set'),
cfg.StrOpt('default-project-type', default='openstack',
help='Default project type'),
cfg.IntOpt('dashboard-update-interval', default=3600,
help='The interval specifies how frequently dashboard should '
'check for updates in seconds'),
]