roster-server 2.3.14 → 2.3.16

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": "roster-server",
3
- "version": "2.3.14",
3
+ "version": "2.3.16",
4
4
  "description": "👾 RosterServer - A domain host router to host multiple HTTPS.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -384,13 +384,34 @@ G.create = function(gconf) {
384
384
  return dir.promise;
385
385
  }
386
386
 
387
- await acme.init(dirUrl).catch(function(err) {
388
- log.error(
389
- "ACME init failed (directory may be down or directoryUrl wrong):",
390
- err.message
391
- );
392
- throw err;
393
- });
387
+ var maxRetries = 3;
388
+ var lastErr;
389
+ for (var attempt = 1; attempt <= maxRetries; attempt++) {
390
+ try {
391
+ await acme.init(dirUrl);
392
+ lastErr = null;
393
+ break;
394
+ } catch (err) {
395
+ lastErr = err;
396
+ log.error(
397
+ "ACME init attempt " +
398
+ attempt +
399
+ "/" +
400
+ maxRetries +
401
+ " failed (directory may be down or directoryUrl wrong):",
402
+ err.message
403
+ );
404
+ if (attempt < maxRetries) {
405
+ await new Promise(function(resolve) {
406
+ setTimeout(resolve, 1000 * attempt);
407
+ });
408
+ }
409
+ }
410
+ }
411
+ if (lastErr) {
412
+ delete caches[dirUrl];
413
+ throw lastErr;
414
+ }
394
415
 
395
416
  caches[dirUrl] = {
396
417
  promise: Promise.resolve(acme),