working on proxy service
This commit is contained in:
parent
1395e448b7
commit
3d9eb2ec9b
3 changed files with 88 additions and 87 deletions
|
|
@ -38,7 +38,7 @@ export class ProxyService {
|
|||
private readonly CACHE_PREFIX = 'proxy:';
|
||||
private readonly WORKING_PROXIES_KEY = 'proxy:working';
|
||||
private readonly PROXY_STATS_KEY = 'proxy:stats';
|
||||
private readonly CHECK_TIMEOUT = 10000; // 10 seconds
|
||||
private readonly CHECK_TIMEOUT = 3000; // 10 seconds
|
||||
private readonly DEFAULT_CHECK_URL = 'https://proxy-detection.stare.gg/?api_key=bd406bf53ddc6abe1d9de5907830a955';
|
||||
private readonly DEFAULT_IP_ADDRESS = '99.246.102.205'
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ export class ProxyService {
|
|||
|
||||
this.httpClient = new HttpClient({
|
||||
timeout: this.CHECK_TIMEOUT,
|
||||
});
|
||||
}, this.logger);
|
||||
|
||||
this.logger.info('ProxyService initialized');
|
||||
}
|
||||
|
|
@ -442,7 +442,6 @@ export class ProxyService {
|
|||
this.logger.info('Starting background proxy validation', { count: proxies.length });
|
||||
const concurrency = 50; // Process 50 proxies concurrently
|
||||
const chunks = this.chunkArray(proxies, concurrency);
|
||||
|
||||
for (const chunk of chunks) {
|
||||
const validationPromises = chunk.map(proxy =>
|
||||
this.checkProxy(proxy).catch(error => {
|
||||
|
|
@ -454,9 +453,7 @@ export class ProxyService {
|
|||
return null;
|
||||
})
|
||||
);
|
||||
|
||||
await Promise.allSettled(validationPromises);
|
||||
|
||||
// Small delay between chunks to avoid overwhelming the system
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue