skip history flush when project is cleared by realtime shutdown

history is flushed by a background cron job anyway
This commit is contained in:
Brian Gough 2019-08-15 09:51:16 +01:00
parent f49f5cbf05
commit a76e0dca88
2 changed files with 4 additions and 0 deletions

View file

@ -28,6 +28,9 @@ module.exports = HistoryManager =
# flush changes and callback (for when we need to know the queue is flushed)
flushProjectChanges: (project_id, options, callback = (error) ->) ->
return callback() if !Settings.apis?.project_history?.enabled
if options.skip_history_flush
logger.log {project_id}, "skipping flush of project history from realtime shutdown"
return callback()
url = "#{Settings.apis.project_history.url}/project/#{project_id}/flush"
qs = {}
qs.background = true if options.background # pass on the background flush option if present

View file

@ -133,6 +133,7 @@ module.exports = HttpController =
timer = new Metrics.Timer("http.deleteProject")
options = {}
options.background = true if req.query?.background # allow non-urgent flushes to be queued
options.skip_history_flush = true if req.query?.shutdown # don't flush history when realtime shuts down
ProjectManager.flushAndDeleteProjectWithLocks project_id, options, (error) ->
timer.done()
return next(error) if error?