🔍 Missing file watching logic for chokidar

This commit is contained in:
2026-03-07 21:09:15 -05:00
parent 42c427c7ea
commit e5e4e82f11
7 changed files with 1186 additions and 1287 deletions

View File

@@ -301,6 +301,27 @@ export default class SocketService extends Service {
},
},
/**
* Compute and broadcast current library statistics to all connected Socket.IO clients.
* Called after every filesystem event (add, unlink, etc.) to keep the UI in sync.
* Emits a single `LS_LIBRARY_STATS` event with totalLocalFiles, alreadyImported,
* newFiles, missingFiles, and percentageImported.
*/
broadcastLibraryStatistics: async (ctx: Context<{ directoryPath?: string }>) => {
try {
const result: any = await this.broker.call("library.getImportStatistics", {
directoryPath: ctx.params?.directoryPath,
});
await this.broker.call("socket.broadcast", {
namespace: "/",
event: "LS_LIBRARY_STATS",
args: [result],
});
} catch (err) {
this.logger.error("[Socket] broadcastLibraryStatistics failed:", err);
}
},
listenFileProgress: {
params: { config: "object", namespace: "string" },
async handler(