Просмотр исходного кода

skip history flush when project is cleared by realtime shutdown

history is flushed by a background cron job anyway
Brian Gough 7 лет назад
Родитель
Сommit
a76e0dca88

+ 3 - 0
services/document-updater/app/coffee/HistoryManager.coffee

@@ -28,6 +28,9 @@ module.exports = HistoryManager =
 	# flush changes and callback (for when we need to know the queue is flushed)
 	# flush changes and callback (for when we need to know the queue is flushed)
 	flushProjectChanges: (project_id, options, callback = (error) ->) ->
 	flushProjectChanges: (project_id, options, callback = (error) ->) ->
 		return callback() if !Settings.apis?.project_history?.enabled
 		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"
 		url = "#{Settings.apis.project_history.url}/project/#{project_id}/flush"
 		qs = {}
 		qs = {}
 		qs.background = true if options.background # pass on the background flush option if present
 		qs.background = true if options.background # pass on the background flush option if present

+ 1 - 0
services/document-updater/app/coffee/HttpController.coffee

@@ -133,6 +133,7 @@ module.exports = HttpController =
 		timer = new Metrics.Timer("http.deleteProject")
 		timer = new Metrics.Timer("http.deleteProject")
 		options = {}
 		options = {}
 		options.background = true if req.query?.background # allow non-urgent flushes to be queued
 		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) ->
 		ProjectManager.flushAndDeleteProjectWithLocks project_id, options, (error) ->
 			timer.done()
 			timer.done()
 			return next(error) if error?
 			return next(error) if error?