From a7e8fb6ee510ec763c3c00f5ac7cd8e627e99f1a Mon Sep 17 00:00:00 2001 From: Kelvin Omereshone Date: Wed, 30 Mar 2022 21:32:08 +0100 Subject: [PATCH 1/2] feat: pull liftTimeout to hook defaults --- lib/hooks/http/index.js | 3 +++ lib/hooks/http/start.js | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/hooks/http/index.js b/lib/hooks/http/index.js index 5d09db202d..eb8075b2fa 100644 --- a/lib/hooks/http/index.js +++ b/lib/hooks/http/index.js @@ -29,6 +29,9 @@ module.exports = function(sails) { // Port to run this app on port: 1337, + // How long before warning Sails is taking too long to lift. + liftTimeout: 4000, + // SSL cert settings end up here ssl: {}, diff --git a/lib/hooks/http/start.js b/lib/hooks/http/start.js index b8a61045ef..736faa4a48 100644 --- a/lib/hooks/http/start.js +++ b/lib/hooks/http/start.js @@ -12,9 +12,7 @@ module.exports = function (sails) { // Used to warn about possible issues if starting the server is taking a long time var liftAbortTimer; - var liftTimeout = sails.config.liftTimeout || 4000; - // TODO: pull this defaulting into `defaults` - // and also ensure this config is properly documented. + var liftTimeout = sails.config.liftTimeout; async.auto({ From 8d78327402f367768ee82c8a8e353f20971efbb3 Mon Sep 17 00:00:00 2001 From: Kelvin Omereshone Date: Wed, 30 Mar 2022 21:36:45 +0100 Subject: [PATCH 2/2] feat: remove declaration of liftTimeout variable --- lib/hooks/http/start.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/hooks/http/start.js b/lib/hooks/http/start.js index 736faa4a48..3913975d0a 100644 --- a/lib/hooks/http/start.js +++ b/lib/hooks/http/start.js @@ -12,7 +12,6 @@ module.exports = function (sails) { // Used to warn about possible issues if starting the server is taking a long time var liftAbortTimer; - var liftTimeout = sails.config.liftTimeout; async.auto({ @@ -38,7 +37,7 @@ module.exports = function (sails) { } // Start timer in case this takes suspiciously long... - liftAbortTimer = setTimeout(failedToStart, liftTimeout); + liftAbortTimer = setTimeout(failedToStart, sails.config.liftTimeout); // If the server fails to start because of an error, or if it's just taking // too long, show some troubleshooting notes and bail out.