mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #31 from sharelatex/bg-prevent-logging-of-oprangenotavailable-to-sentry
Reduce logging to sentry (connects to #30)
This commit is contained in:
commit
fd80218e51
1 changed files with 9 additions and 1 deletions
|
@ -2,6 +2,7 @@ Settings = require('settings-sharelatex')
|
|||
logger = require('logger-sharelatex')
|
||||
Keys = require('./UpdateKeys')
|
||||
redis = require("redis-sharelatex")
|
||||
Errors = require("./Errors")
|
||||
|
||||
UpdateManager = require('./UpdateManager')
|
||||
Metrics = require('./Metrics')
|
||||
|
@ -23,7 +24,14 @@ module.exports = DispatchManager =
|
|||
# Dispatch this in the background
|
||||
backgroundTask = (cb) ->
|
||||
UpdateManager.processOutstandingUpdatesWithLock project_id, doc_id, (error) ->
|
||||
logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" if error?
|
||||
# log everything except OpRangeNotAvailable errors, these are normal
|
||||
if error?
|
||||
# downgrade OpRangeNotAvailable and "Delete component" errors so they are not sent to sentry
|
||||
logAsWarning = (error instanceof Errors.OpRangeNotAvailableError) || error.message?.match(/^Delete component/)
|
||||
if logAsWarning
|
||||
logger.warn err: error, project_id: project_id, doc_id: doc_id, "error processing update"
|
||||
else
|
||||
logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update"
|
||||
cb()
|
||||
RateLimiter.run backgroundTask, callback
|
||||
|
||||
|
|
Loading…
Reference in a new issue