Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/daemon/readers/local-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ export class LocalFilesEpisodeReader implements IEpisodeReader {

try {
content = readFileSync(filePath, "utf8");
mtimeMs = statSync(filePath).mtimeMs;
// fs.Stats.mtimeMs is a float on most filesystems (sub-millisecond
// precision is preserved when available — see Node fs docs). Coerce
// to integer ms here so the value can be stored in the BIGINT
// columns used for created_at / updated_at / last_accessed_at /
// max_message_time. Postgres rejects fractional bigints with
// "invalid input syntax for type bigint: \"…\".\"…\"".
mtimeMs = Math.floor(statSync(filePath).mtimeMs);
} catch {
// File disappeared between scan and read — skip silently.
continue;
Expand Down Expand Up @@ -171,7 +177,8 @@ export class LocalFilesEpisodeReader implements IEpisodeReader {
const fullPath = join(this.dir, entry.name);
try {
const stat = statSync(fullPath);
results.push({ path: fullPath, mtimeMs: stat.mtimeMs });
// Coerce to integer ms — see comment in getNewEpisodes.
results.push({ path: fullPath, mtimeMs: Math.floor(stat.mtimeMs) });
} catch {
// File disappeared between readdir and stat — skip.
}
Expand Down
Loading