mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-24 22:03:57 +00:00
avoid graphite drift in active worker count
This commit is contained in:
parent
9a8c0fda10
commit
fa089dc28d
1 changed files with 4 additions and 2 deletions
|
@ -11,17 +11,19 @@ module.exports = class RateLimiter
|
||||||
|
|
||||||
_adjustLimitUp: () ->
|
_adjustLimitUp: () ->
|
||||||
@CurrentWorkerLimit += 0.1 # allow target worker limit to increase gradually
|
@CurrentWorkerLimit += 0.1 # allow target worker limit to increase gradually
|
||||||
|
Metrics.gauge "currentLimit", Math.ceil(@CurrentWorkerLimit)
|
||||||
|
|
||||||
_adjustLimitDown: () ->
|
_adjustLimitDown: () ->
|
||||||
@CurrentWorkerLimit = Math.max @BaseWorkerCount, (@CurrentWorkerLimit * 0.9)
|
@CurrentWorkerLimit = Math.max @BaseWorkerCount, (@CurrentWorkerLimit * 0.9)
|
||||||
logger.log {currentLimit: Math.ceil(@CurrentWorkerLimit)}, "reducing rate limit"
|
logger.log {currentLimit: Math.ceil(@CurrentWorkerLimit)}, "reducing rate limit"
|
||||||
|
Metrics.gauge "currentLimit", Math.ceil(@CurrentWorkerLimit)
|
||||||
|
|
||||||
_trackAndRun: (task, callback = () ->) ->
|
_trackAndRun: (task, callback = () ->) ->
|
||||||
@ActiveWorkerCount++
|
@ActiveWorkerCount++
|
||||||
Metrics.gauge "processingUpdates", "+1" # increments/decrements gauge with +/- sign
|
Metrics.gauge "processingUpdates", @ActiveWorkerCount
|
||||||
task (err) =>
|
task (err) =>
|
||||||
@ActiveWorkerCount--
|
@ActiveWorkerCount--
|
||||||
Metrics.gauge "processingUpdates", "-1"
|
Metrics.gauge "processingUpdates", @ActiveWorkerCount
|
||||||
callback(err)
|
callback(err)
|
||||||
|
|
||||||
run: (task, callback) ->
|
run: (task, callback) ->
|
||||||
|
|
Loading…
Reference in a new issue