mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #1885 from overleaf/sk-dep-upgrades-2019-06
Update logger, metrics, and redis client GitOrigin-RevId: fa425f37c9065dc644da44f62e89a9955ce09f66
This commit is contained in:
parent
f84c43a7b7
commit
b86f46a4f8
5 changed files with 417 additions and 924 deletions
|
@ -22,15 +22,13 @@ module.exports = {
|
|||
timeInterval: ONE_MIN * 2,
|
||||
subjectName: email
|
||||
}
|
||||
return RateLimiter.addCount(opts, (err, shouldAllow) =>
|
||||
callback(err, shouldAllow)
|
||||
)
|
||||
RateLimiter.addCount(opts, (err, shouldAllow) => callback(err, shouldAllow))
|
||||
},
|
||||
|
||||
recordSuccessfulLogin(email, callback) {
|
||||
if (callback == null) {
|
||||
callback = function() {}
|
||||
}
|
||||
return RateLimiter.clearRateLimit('login', email, callback)
|
||||
RateLimiter.clearRateLimit('login', email, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ module.exports = LockManager = {
|
|||
|
||||
const timer = new metrics.Timer(`lock.${namespace}`)
|
||||
const key = `lock:web:${namespace}:${id}`
|
||||
return LockManager._getLock(key, namespace, function(error, lockValue) {
|
||||
LockManager._getLock(key, namespace, function(error, lockValue) {
|
||||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ module.exports = LockManager = {
|
|||
callback = function(err, isFree, lockValue) {}
|
||||
}
|
||||
const lockValue = LockManager.randomLock()
|
||||
return rclient.set(
|
||||
rclient.set(
|
||||
key,
|
||||
lockValue,
|
||||
'EX',
|
||||
|
@ -195,7 +195,7 @@ module.exports = LockManager = {
|
|||
},
|
||||
|
||||
_releaseLock(key, lockValue, callback) {
|
||||
return rclient.eval(LockManager.unlockScript, 1, key, lockValue, function(
|
||||
rclient.eval(LockManager.unlockScript, 1, key, lockValue, function(
|
||||
err,
|
||||
result
|
||||
) {
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = RateLimiter = {
|
|||
interval: opts.timeInterval * 1000,
|
||||
maxInInterval: opts.throttle
|
||||
})
|
||||
return limiter(k, function(err, timeLeft, actionsLeft) {
|
||||
limiter(k, function(err, timeLeft, actionsLeft) {
|
||||
if (err != null) {
|
||||
return callback(err)
|
||||
}
|
||||
|
@ -48,6 +48,6 @@ module.exports = RateLimiter = {
|
|||
clearRateLimit(endpointName, subject, callback) {
|
||||
// same as the key which will be built by RollingRateLimiter (namespace+k)
|
||||
const keyName = `RateLimit:${endpointName}:{${subject}}`
|
||||
return rclient.del(keyName, callback)
|
||||
rclient.del(keyName, callback)
|
||||
}
|
||||
}
|
||||
|
|
1319
services/web/npm-shrinkwrap.json
generated
1319
services/web/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
|
@ -60,12 +60,12 @@
|
|||
"jsonwebtoken": "^8.0.1",
|
||||
"ldapjs": "^0.7.1",
|
||||
"lodash": "^4.13.1",
|
||||
"logger-sharelatex": "^1.6.0",
|
||||
"logger-sharelatex": "^1.7.0",
|
||||
"lynx": "0.1.1",
|
||||
"mailchimp-api-v3": "^1.12.0",
|
||||
"marked": "^0.3.5",
|
||||
"method-override": "^2.3.3",
|
||||
"metrics-sharelatex": "^2.1.1",
|
||||
"metrics-sharelatex": "^2.2.0",
|
||||
"minimist": "1.2.0",
|
||||
"mmmagic": "^0.5.2",
|
||||
"mocha": "^5.0.1",
|
||||
|
@ -93,7 +93,7 @@
|
|||
"pug": "^2.0.0-beta6",
|
||||
"react": "^15.4.2",
|
||||
"react-dom": "^15.4.2",
|
||||
"redis-sharelatex": "^1.0.5",
|
||||
"redis-sharelatex": "^1.0.8",
|
||||
"request": "^2.69.0",
|
||||
"requestretry": "^1.13.0",
|
||||
"requests": "^0.1.7",
|
||||
|
|
Loading…
Reference in a new issue