mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
adding file polling for windows machines
This commit is contained in:
@@ -31,6 +31,7 @@ const sampleCompose = `services:
|
||||
- .env # needs to have your CANVAS_TOKEN set
|
||||
environment:
|
||||
- TZ=America/Denver # prevents timezone issues for due dates
|
||||
# - FILE_POLLING=true # increases cpu usage, uncomment if source volumes are on ntfs
|
||||
volumes:
|
||||
- ~/projects/faculty/1430/2024-fall-alex/modules:/app/storage/UX
|
||||
- ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/advanced_frontend
|
||||
|
||||
@@ -3,6 +3,8 @@ import next from "next";
|
||||
import { Server } from "socket.io";
|
||||
import chokidar from "chokidar";
|
||||
import path from "path";
|
||||
import dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
const dev = process.env.NODE_ENV !== "production";
|
||||
const hostname = "localhost";
|
||||
@@ -14,12 +16,18 @@ const handler = app.getRequestHandler();
|
||||
|
||||
const folderToWatch = path.join(process.cwd(), "./storage", "/");
|
||||
console.log("watching folder", folderToWatch);
|
||||
const usePolling = process.env.FILE_POLLING === "true";
|
||||
console.log("FILE_POLLING:", usePolling);
|
||||
|
||||
const watcher = chokidar.watch(folderToWatch, {
|
||||
persistent: true,
|
||||
usePolling,
|
||||
});
|
||||
|
||||
app.prepare().then(() => {
|
||||
const httpServer = createServer(handler);
|
||||
|
||||
const io = new Server(httpServer);
|
||||
const watcher = chokidar.watch(folderToWatch, { persistent: true });
|
||||
|
||||
io.on("connection", (socket) => {
|
||||
console.log("websocket connection created");
|
||||
|
||||
Reference in New Issue
Block a user