roster-server 2.1.25 → 2.1.26

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.
Files changed (2) hide show
  1. package/index.js +26 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -777,14 +777,34 @@ class Roster {
777
777
 
778
778
  const isBunRuntime = typeof Bun !== 'undefined' || process.release?.name === 'bun';
779
779
  if (isBunRuntime && this.wildcardZones.size > 0) {
780
+ const retryDelayMs = Number.isFinite(Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_RETRY_MS))
781
+ ? Math.max(1000, Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_RETRY_MS))
782
+ : 30000;
783
+ const maxAttempts = Number.isFinite(Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_MAX_ATTEMPTS))
784
+ ? Math.max(0, Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_MAX_ATTEMPTS))
785
+ : 0; // 0 = retry forever
786
+
780
787
  for (const zone of this.wildcardZones) {
781
788
  const bootstrapHost = `bun-bootstrap.${zone}`;
782
- try {
783
- log.warn(`⚠️ Bun runtime detected: prewarming wildcard certificate via ${bootstrapHost}`);
784
- await greenlockRuntime.get({ servername: bootstrapHost });
785
- } catch (error) {
786
- log.warn(`⚠️ Bun wildcard prewarm failed for ${zone}: ${error?.message || error}`);
787
- }
789
+ const attemptPrewarm = async (attempt = 1) => {
790
+ try {
791
+ log.warn(`⚠️ Bun runtime detected: prewarming wildcard certificate via ${bootstrapHost} (attempt ${attempt})`);
792
+ await greenlockRuntime.get({ servername: bootstrapHost });
793
+ log.info(`✅ Bun wildcard prewarm succeeded for ${zone} on attempt ${attempt}`);
794
+ } catch (error) {
795
+ log.warn(`⚠️ Bun wildcard prewarm failed for ${zone} (attempt ${attempt}): ${error?.message || error}`);
796
+ if (maxAttempts > 0 && attempt >= maxAttempts) {
797
+ log.warn(`⚠️ Bun wildcard prewarm stopped for ${zone} after ${attempt} attempts`);
798
+ return;
799
+ }
800
+ setTimeout(() => {
801
+ attemptPrewarm(attempt + 1).catch(() => {});
802
+ }, retryDelayMs);
803
+ }
804
+ };
805
+
806
+ // Background prewarm + retries so HTTPS startup is not blocked by DNS propagation timing.
807
+ attemptPrewarm().catch(() => {});
788
808
  }
789
809
  }
790
810
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roster-server",
3
- "version": "2.1.25",
3
+ "version": "2.1.26",
4
4
  "description": "👾 RosterServer - A domain host router to host multiple HTTPS.",
5
5
  "main": "index.js",
6
6
  "scripts": {