puppyproxy 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puppyproxy",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Node.js library for managing, scraping, and using proxies with fetch and WebSocket support",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.ts",
package/src/PuppyProxy.js CHANGED
@@ -49,6 +49,13 @@ export default class PuppyProxy {
49
49
  // Load scraped proxies into memory
50
50
  await this.scraper.runCollector(forceCollector);
51
51
  await this.scraper.loadScrapedProxies();
52
+
53
+ if (this.config.scraper?.autoCollectProxies) {
54
+ log.info(id, `Auto proxy collection enabled. Running every ${this.config.scraper.autoCollectProxies} minutes.`);
55
+ setInterval(async () => {
56
+ await this.scraper.runCollector();
57
+ }, (this.config.scraper.autoCollectProxies) * 60e3); // minutes to ms
58
+ }
52
59
  }
53
60
 
54
61
  /**
@@ -91,7 +91,6 @@ export default class Scraper {
91
91
  return null;
92
92
  }
93
93
 
94
- // Worker Orchestration
95
94
  async runCollector(force = false) {
96
95
  let lastSaved = (Date.now() - getLastSavedTimestamp(this.outputPath)) / 1000; // ms to seconds
97
96
  if (lastSaved && !force) {