Merge pull request #320 from sharelatex/sk-retry-analytics-requests

Add a retry to analytics requests
This commit is contained in:
Shane Kilkelly 2018-02-13 09:38:56 +00:00 committed by GitHub
commit 9a7b3c2b23
3 changed files with 16 additions and 1 deletions

View file

@ -1,7 +1,7 @@
settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
_ = require "underscore"
request = require "request"
request = require "requestretry"
Errors = require '../Errors/Errors'
@ -37,6 +37,8 @@ module.exports =
method:"POST"
timeout:1000
url: "/user/#{user_id}/event"
maxAttempts: 20
retryDelay: 5000
if settings.overleaf?
opts.qs = {fromV2: 1}
makeRequest opts, callback
@ -54,6 +56,8 @@ module.exports =
qs:
userId: userId
projectId: projectId
maxAttempts: 20
retryDelay: 5000
if settings.overleaf?
opts.qs.fromV2 = 1
makeRequest opts, callback

View file

@ -6931,6 +6931,11 @@
"from": "request@>=2.69.0 <3.0.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz"
},
"requestretry": {
"version": "1.13.0",
"from": "requestretry@latest",
"resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.13.0.tgz"
},
"requests": {
"version": "0.1.7",
"from": "requests@>=0.1.7 <0.2.0",
@ -9314,6 +9319,11 @@
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz",
"dev": true
},
"when": {
"version": "3.7.8",
"from": "when@>=3.7.7 <4.0.0",
"resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz"
},
"which": {
"version": "1.0.9",
"from": "which@>=1.0.5 <1.1.0",

View file

@ -72,6 +72,7 @@
"pug": "^2.0.0-beta6",
"redis-sharelatex": "git+https://github.com/sharelatex/redis-sharelatex.git#v1.0.4",
"request": "^2.69.0",
"requestretry": "^1.13.0",
"requests": "^0.1.7",
"rimraf": "2.2.6",
"rolling-rate-limiter": "git+https://github.com/ShaneKilkelly/rolling-rate-limiter.git#master",