This commit is contained in:
Raphaël Jakse 2020-04-05 12:34:30 +02:00
parent 3604379b0c
commit 05eaebd697
2 changed files with 13 additions and 8 deletions

View File

@ -255,7 +255,12 @@
"prefer-spread": "error",
"prefer-template": "off",
"quote-props": "off",
"quotes": "off",
"quotes": [
"error",
"double", {
"avoidEscape": true
}
],
"radix": [
"error",
"as-needed"

View File

@ -35,8 +35,8 @@ function envTrue(name) {
return (process.env[name] || "").toLowerCase() === "true";
}
const DEV_ENABLE_SERVING_FILES = envTrue('DEV_ENABLE_SERVING_FILES');
const DEBUG_LOG = DEV_ENABLE_SERVING_FILES || envTrue('DEBUG_LOG');
const DEV_ENABLE_SERVING_FILES = envTrue("DEV_ENABLE_SERVING_FILES");
const DEBUG_LOG = DEV_ENABLE_SERVING_FILES || envTrue("DEBUG_LOG");
if (DEV_ENABLE_SERVING_FILES) {
console.log("DEV_ENABLE_SERVING_FILES: Serving files in the current directory. Please never do this on a production server, this is for development purposes only.");
@ -111,7 +111,7 @@ var frValues = {
var games = {};
var dateNow = 0;
var saveTo = null;
var saveTimeout = null;
function saveGames() {
fs.writeFile("games.backup.json", JSON.stringify(games), function (err) {
@ -120,7 +120,7 @@ function saveGames() {
}
});
saveTo = null;
saveTimeout = null;
}
function Game() {
@ -302,8 +302,8 @@ Game.prototype.commit = function () {
}
}
if (saveTo === null) {
saveTo = setTimeout(saveGames, SAVE_TIMEOUT);
if (saveTimeout === null) {
saveTimeout = setTimeout(saveGames, SAVE_TIMEOUT);
}
};
@ -698,7 +698,7 @@ function handleRequest(request, response) {
var post = "";
var responseAndIsES = [response, false];
response.on("error", function (e) {
response.on("error", function connectionError(e) {
console.error("An error occurred while trying to write on a socket", e);
stopKeepAlive(responseAndIsES);
});