 	app.use app.router
 
 rclient.subscribe("pending-updates")
-rclient.on "message", (channel, doc_key)->
+rclient.on "message", (channel, doc_key) ->
 	[project_id, doc_id] = Keys.splitProjectIdAndDocId(doc_key)
-	UpdateManager.processOutstandingUpdatesWithLock project_id, doc_id, (error) ->
-		logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" if error?
+	if !Settings.shuttingDown
+		UpdateManager.processOutstandingUpdatesWithLock project_id, doc_id, (error) ->
+			logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" if error?
+	else
+		logger.log project_id: project_id, doc_id: doc_id, "ignoring incoming update" 
 
 UpdateManager.resumeProcessing()
 

	else
		res.send(500, "Oops, something went wrong")

port = Settings.internal?.documentupdater?.port or Settings.apis?.documentupdater?.port or 3003
app.listen port, "localhost", ->
	logger.log("documentupdater-sharelatex server listening on port #{port}")

		res.send {total:count}
	
app.get '/status', (req, res)->
	if Settings.shuttingDown
		res.send 503 # Service unavailable
	else
		res.send('document updater is alive')

app.use (error, req, res, next) ->
	logger.error err: error, "request errored"
