locize-cli
Advanced tools
Comparing version 7.12.4 to 7.12.5
@@ -8,2 +8,6 @@ # locize-cli change log | ||
## [7.12.5](https://github.com/locize/locize-cli/compare/v7.12.4...v7.12.5) - 2022-08-25 | ||
- update dependencies | ||
## [7.12.4](https://github.com/locize/locize-cli/compare/v7.12.3...v7.12.4) - 2022-07-20 | ||
@@ -10,0 +14,0 @@ |
@@ -5,3 +5,5 @@ const request = require('./request'); | ||
const getRemoteNamespace = (opt, lng, ns, cb) => { | ||
const getRandomDelay = (delayFrom, delayTo) => Math.floor(Math.random() * delayTo) + delayFrom; | ||
const getRemoteNamespace = (opt, lng, ns, cb, retry) => { | ||
request(opt.apiPath + (opt.isPrivate ? '/private' : opt.unpublished ? '/pull' : '') + '/' + opt.projectId + '/' + opt.version + '/' + lng + '/' + ns + '?ts=' + Date.now(), { | ||
@@ -15,2 +17,9 @@ method: 'get', | ||
if (res.status >= 300) { | ||
retry = retry || 0; | ||
if (retry < 3 && res.status !== 401) { | ||
setTimeout(() => { | ||
getRemoteNamespace(opt, lng, ns, cb, retry + 1); | ||
}, opt.unpublished ? getRandomDelay(3000, 10000) : getRandomDelay(100, 1000)); | ||
return; | ||
} | ||
if (obj && (obj.errorMessage || obj.message)) { | ||
@@ -17,0 +26,0 @@ return cb(new Error((obj.errorMessage || obj.message))); |
{ | ||
"name": "locize-cli", | ||
"version": "7.12.4", | ||
"version": "7.12.5", | ||
"description": "locize cli to import locales", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"https-proxy-agent": "5.0.1", | ||
"ini": "3.0.0", | ||
"ini": "3.0.1", | ||
"js-yaml": "4.1.0", | ||
@@ -37,3 +37,3 @@ "laravelphp": "2.0.3", | ||
"devDependencies": { | ||
"eslint": "8.21.0", | ||
"eslint": "8.22.0", | ||
"gh-release": "6.0.4", | ||
@@ -40,0 +40,0 @@ "pkg": "5.8.0" |
165753
2853