fix(fetcher): never block flaresolverr timeouts
This commit is contained in:
parent
1f4d81bfc9
commit
c23ffa382d
1 changed files with 8 additions and 3 deletions
|
|
@ -159,7 +159,7 @@ export class Fetcher {
|
|||
}
|
||||
|
||||
const timeouts = (await this.timeoutsCountCache.get<number>(url.host)) ?? 0;
|
||||
if (timeouts >= (requestConfig?.timeoutsCountThrow ?? this.DEFAULT_TIMEOUTS_COUNT_THROW)) {
|
||||
if (!this.isFlareSolverrUrl(url) && timeouts >= (requestConfig?.timeoutsCountThrow ?? this.DEFAULT_TIMEOUTS_COUNT_THROW)) {
|
||||
throw new TooManyTimeoutsError(url);
|
||||
}
|
||||
|
||||
|
|
@ -357,13 +357,18 @@ export class Fetcher {
|
|||
return new Promise(sleep => setTimeout(sleep, ms));
|
||||
}
|
||||
|
||||
private isFlareSolverrUrl(url: URL): boolean {
|
||||
const flareSolverrEndpoint = envGet('FLARESOLVERR_ENDPOINT');
|
||||
|
||||
return !!flareSolverrEndpoint && url.href.startsWith(flareSolverrEndpoint);
|
||||
}
|
||||
|
||||
private getProxyForUrl(ctx: Context, url: URL): URL | undefined {
|
||||
if (ctx.config.mediaFlowProxyUrl && url.href.includes(ctx.config.mediaFlowProxyUrl)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const flareSolverrEndpoint = envGet('FLARESOLVERR_ENDPOINT');
|
||||
if (flareSolverrEndpoint && url.href.startsWith(flareSolverrEndpoint)) {
|
||||
if (this.isFlareSolverrUrl(url)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue