@quintype/framework 7.1.0 → 7.1.1-socket-timeout.0
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 +2 -2
- package/server/start.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.1.0",
|
|
3
|
+
"version": "7.1.1-socket-timeout.0",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
30
30
|
"@quintype/amp": "^2.4.19",
|
|
31
|
-
"@quintype/backend": "^2.2.0",
|
|
31
|
+
"@quintype/backend": "^2.2.1-socket-timeout.0",
|
|
32
32
|
"@quintype/components": "^3.0.0",
|
|
33
33
|
"@quintype/prerender-node": "^3.2.24",
|
|
34
34
|
"@quintype/seo": "^1.38.1",
|
package/server/start.js
CHANGED
|
@@ -16,6 +16,7 @@ const process = require("process");
|
|
|
16
16
|
const { initializeAllClients } = require("./api-client");
|
|
17
17
|
const logger = require("./logger");
|
|
18
18
|
const logSuccess = chalk.bold.cyanBright;
|
|
19
|
+
const http = require('http');
|
|
19
20
|
|
|
20
21
|
function startMaster({ workers = 4 }) {
|
|
21
22
|
let terminating = false;
|
|
@@ -73,12 +74,19 @@ async function startWorker(appThunk, opts) {
|
|
|
73
74
|
const app = appThunk();
|
|
74
75
|
|
|
75
76
|
await initializeAllClients();
|
|
76
|
-
const server = app.listen(opts.port || 3000, () => {
|
|
77
|
+
const server = http.createServer(app).listen(opts.port || 3000, () => {
|
|
77
78
|
console.log(logSuccess(`||=============================||`));
|
|
78
|
-
console.log(logSuccess(`|| App listening on port ${opts.port || 3000}! ||`))
|
|
79
|
+
console.log(logSuccess(`|| App listening on port ${opts.port || 3000}! ||`));
|
|
79
80
|
console.log(logSuccess(`||=============================||`));
|
|
80
81
|
});
|
|
81
82
|
|
|
83
|
+
server.setTimeout(900,()=>{
|
|
84
|
+
console.log("Socket is destroyed due to timeout");
|
|
85
|
+
server.close(()=>{
|
|
86
|
+
console.log("Server is closed");
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
82
90
|
process.on("SIGTERM", () => {
|
|
83
91
|
server.close(() => {
|
|
84
92
|
cluster.worker.disconnect();
|