From dde8eba9bc4b937339007554e207384d95dccb93 Mon Sep 17 00:00:00 2001 From: HF Date: Sun, 21 Aug 2022 20:54:19 +0200 Subject: [PATCH] use HourlyCron instead of own timeout for proxycheck key refresh --- src/utils/ProxyCheck.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/ProxyCheck.js b/src/utils/ProxyCheck.js index ed2424f..5e967f3 100644 --- a/src/utils/ProxyCheck.js +++ b/src/utils/ProxyCheck.js @@ -7,6 +7,7 @@ import https from 'https'; import { HOUR } from '../core/constants'; +import { HourlyCron } from './cron'; /* @@ -41,7 +42,7 @@ class PcKeyProvider { this.disabledKeys = []; this.logger = logger; this.getKeysUsage(keys); - setInterval(this.updateKeys, 1 * HOUR); + HourlyCron.hook(this.updateKeys); } /* @@ -195,6 +196,13 @@ class PcKeyProvider { }); } + /* + * wrapper to update keys + */ + updateKeys() { + this.pcKeyProvider.updateKeys(); + } + /* * report denied key (over daily quota, rate limited, blocked,...) * @param key