зеркало из https://github.com/microsoft/ghcrawler.git
fix slice problem
This commit is contained in:
Родитель
d453ea7ec0
Коммит
2b2872d32a
|
@ -37,6 +37,7 @@ class GitHubFetcher {
|
|||
const etagPromise = checkEtag ? this.store.etag(request.type, request.url) : Q(null);
|
||||
return etagPromise.then(etag => {
|
||||
let options = self._addTokenOption(request, { headers: {} });
|
||||
const token = options.headers.authorization.slice(6);
|
||||
if (typeof options === 'number') {
|
||||
// if we get back a number, all tokens have been benched so we have to requeue and wait.
|
||||
return self._requeueBenched(request, options);
|
||||
|
@ -59,7 +60,6 @@ class GitHubFetcher {
|
|||
// we have already retried. Retries will be done with full permission tokens so if there is still
|
||||
// a problem then we are done here.
|
||||
if ([401, 403, 404].includes(response.statusCode)) {
|
||||
const token = options.headers.authorization.slice(6);
|
||||
request.addMeta({ token: `${token.slice(0, 2)}..${token.slice(-2)}` });
|
||||
if (request.attemptCount && request.attemptCount > 1) {
|
||||
return request.markDead('Bailed', `After ${request.attemptCount} tries.`);
|
||||
|
|
Загрузка…
Ссылка в новой задаче