mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
log clsi concurrency (#19651)
GitOrigin-RevId: 504f6f9cc3d4b7386dbcde86f76c1cf3a13e944f
This commit is contained in:
parent
77a78a4458
commit
01b7896717
1 changed files with 6 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
const logger = require('@overleaf/logger')
|
||||
const Errors = require('./Errors')
|
||||
const RequestParser = require('./RequestParser')
|
||||
const Metrics = require('@overleaf/metrics')
|
||||
|
||||
// The lock timeout should be higher than the maximum end-to-end compile time.
|
||||
// Here, we use the maximum compile timeout plus 2 minutes.
|
||||
|
@ -19,6 +20,8 @@ function acquire(key) {
|
|||
}
|
||||
}
|
||||
|
||||
Metrics.gauge('concurrent_compile_requests', LOCKS.size)
|
||||
|
||||
const lock = new Lock(key)
|
||||
LOCKS.set(key, lock)
|
||||
return lock
|
||||
|
@ -39,6 +42,9 @@ class Lock {
|
|||
if (!lockWasActive) {
|
||||
logger.error({ key: this.key }, 'Lock was released twice')
|
||||
}
|
||||
if (this.isExpired()) {
|
||||
Metrics.inc('compile_lock_expired_before_release')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue