From 487a603fa3d4289e11a8649f6c9f40c35ebbc47e Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sat, 14 Feb 2026 12:42:20 +0000 Subject: [PATCH] fix(smart-proxy): start metrics polling before certificate provisioning to avoid blocking metrics collection --- changelog.md | 7 +++++++ ts/00_commitinfo_data.ts | 2 +- ts/proxies/smart-proxy/smart-proxy.ts | 11 +++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 26f29ae..6b8c684 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2026-02-14 - 25.2.2 - fix(smart-proxy) +start metrics polling before certificate provisioning to avoid blocking metrics collection + +- Start metrics polling immediately after Rust engine startup so metrics are available without waiting for certificate provisioning. +- Run certProvisionFunction after startup because ACME/DNS-01 provisioning can hang or be slow and must not block observability. +- Code change in ts/proxies/smart-proxy/smart-proxy.ts: metricsAdapter.startPolling() moved to run before provisionCertificatesViaCallback(). + ## 2026-02-14 - 25.2.1 - fix(smartproxy) no changes detected in git diff diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index f4982a4..53ca93d 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartproxy', - version: '25.2.1', + version: '25.2.2', description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.' } diff --git a/ts/proxies/smart-proxy/smart-proxy.ts b/ts/proxies/smart-proxy/smart-proxy.ts index 1673ea9..35bfc58 100644 --- a/ts/proxies/smart-proxy/smart-proxy.ts +++ b/ts/proxies/smart-proxy/smart-proxy.ts @@ -191,13 +191,16 @@ export class SmartProxy extends plugins.EventEmitter { } } - // Handle certProvisionFunction - await this.provisionCertificatesViaCallback(preloadedDomains); - - // Start metrics polling + // Start metrics polling BEFORE cert provisioning — the Rust engine is already + // running and accepting connections, so metrics should be available immediately. + // Cert provisioning can hang indefinitely (e.g. DNS-01 ACME timeouts) and must + // not block metrics collection. this.metricsAdapter.startPolling(); logger.log('info', 'SmartProxy started (Rust engine)', { component: 'smart-proxy' }); + + // Handle certProvisionFunction (may be slow — runs after startup is complete) + await this.provisionCertificatesViaCallback(preloadedDomains); } /**