mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 16:30:48 +00:00
[RedisManager] block inserting of too large docs into redis
This commit is contained in:
parent
a4ae0ea12f
commit
c707d0b345
1 changed files with 7 additions and 0 deletions
|
@ -72,6 +72,13 @@ module.exports = RedisManager = {
|
||||||
logger.error({ err: error, doc_id, docLines }, error.message)
|
logger.error({ err: error, doc_id, docLines }, error.message)
|
||||||
return callback(error)
|
return callback(error)
|
||||||
}
|
}
|
||||||
|
// Do a cheap size check on the serialized blob.
|
||||||
|
if (docLines.length > Settings.max_doc_length) {
|
||||||
|
const docSize = docLines.length
|
||||||
|
const err = new Error('blocking doc insert into redis: doc is too large')
|
||||||
|
logger.error({ project_id, doc_id, err, docSize }, err.message)
|
||||||
|
return callback(err)
|
||||||
|
}
|
||||||
const docHash = RedisManager._computeHash(docLines)
|
const docHash = RedisManager._computeHash(docLines)
|
||||||
// record bytes sent to redis
|
// record bytes sent to redis
|
||||||
metrics.summary('redis.docLines', docLines.length, { status: 'set' })
|
metrics.summary('redis.docLines', docLines.length, { status: 'set' })
|
||||||
|
|
Loading…
Reference in a new issue