CF don't like us if we go to fast. Let's add some delays.

This commit is contained in:
Godzil 2020-04-27 22:39:03 +01:00
parent e058b8e699
commit d692199d07
3 changed files with 9 additions and 4 deletions

View File

@ -170,7 +170,7 @@ export default function(args: string[], done: (err?: Error) => void)
{
i += 1;
}
next();
setTimeout(next, config.sleepTime);
});
})();
});
@ -405,5 +405,6 @@ function parse(args: string[]): IConfigLine
.option('--debug', 'Create a debug file. Use only if requested!')
.option('--rebuildcrp', 'Rebuild the crpersistant file.')
.option('--retry <i>', 'Number or time to retry fetching an episode.', '5')
.option('--sleepTime <i>', 'Minimum wait time between each http requests.')
.parse(args);
}

View File

@ -24,6 +24,7 @@ interface IConfig {
debug?: boolean;
unlog?: boolean;
retry?: number;
sleepTime?: number;
// Login options
userAgent?: string;
logUsingApi?: boolean;

View File

@ -106,7 +106,8 @@ export default function(config: IConfig, task: IConfigTask, done: (err: any) =>
'" - Retry ' + page.episodes[i].retry + ' / ' + config.retry);
page.episodes[i].retry -= 1;
}
next();
setTimeout(next, config.sleepTime);
return;
}
else
{
@ -121,13 +122,15 @@ export default function(config: IConfig, task: IConfigTask, done: (err: any) =>
}
i += 1;
next();
setTimeout(next, config.sleepTime);
return;
});
}
else
{
i += 1;
next();
setTimeout(next, config.sleepTime);
return;
}
}
});