Use a queue for fixing missing matches
This commit is contained in:
parent
3428986268
commit
3876a85a73
3 changed files with 30 additions and 33 deletions
|
@ -22,7 +22,7 @@ export function* lookupId(id, type) {
|
|||
|
||||
const result = results[0];
|
||||
|
||||
if (!result || !result.Error) {
|
||||
if (!result || result.Error) {
|
||||
return { service: 'amazon' };
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ export function* lookupId(id, type) {
|
|||
return { service: 'amazon' };
|
||||
}
|
||||
|
||||
export function* search(data, original = {}) {
|
||||
export function* search(data) {
|
||||
try {
|
||||
const type = data.type;
|
||||
const results = yield client.itemSearch({
|
||||
|
@ -80,7 +80,7 @@ export function* search(data, original = {}) {
|
|||
|
||||
const result = results[0];
|
||||
|
||||
if (!result || !result.Error) {
|
||||
if (!result || result.Error) {
|
||||
return { service: 'amazon' };
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,10 @@ export function* search(data, original = {}) {
|
|||
}
|
||||
} catch (err) {
|
||||
debug(inspect(err, { depth: 4 }));
|
||||
if (err[0].Error[0].Code[0] === 'RequestThrottled') {
|
||||
debug('Rate Limited');
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
return { service: 'amazon' };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue