From f9124f6e077d0bc01c0158f2554ac9605cdfc746 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 14 Mar 2024 01:10:36 +0100 Subject: Don't use chokidar. It's unreliable and regularly misses file changes on the production server. --- package.json | 1 - server.js | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8a50d86..aa1885a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "dependencies": { "better-sqlite3": "^9.4.1", "bufferutil": "^4.0.8", - "chokidar": "^3.6.0", "dotenv": "^16.4.4", "express": "^4.18.2", "nodemailer": "^6.9.9", diff --git a/server.js b/server.js index 705eb8f..dcc6208 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,6 @@ const https = require("https") // for webhook requests const { WebSocketServer } = require("ws") const express = require("express") const url = require("url") -const chokidar = require("chokidar") const sqlite3 = require("better-sqlite3") require("dotenv").config() @@ -1197,8 +1196,10 @@ function watch_rules(rules_dir, rules_file, title) { } } - // ALSO: for (let file of watch_list) fs.watchFile(file, reload_rules) - chokidar.watch(watch_list, { ignoreInitial: true, awaitWriteFinish: true }).on("all", reload_rules) + // TODO: figure out why chokidar is unreliable on production server + // chokidar.watch(watch_list, { ignoreInitial: true, awaitWriteFinish: true }).on("all", reload_rules) + for (let file of watch_list) + fs.watchFile(file, reload_rules) } function load_titles() { -- cgit v1.2.3