mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
chore(kobo): fix invalidateSnapshot log format and remove unbounded bookIds field
The debug log in invalidateSnapshot did not follow the project logging convention ([event] [phase] key=value ... - message) and logged all reset book IDs, which could produce unbounded single-line output for large libraries. Fix the event name, add the [end] phase marker, add durationMs, drop the bookIds field, and remove the no-snapshot early-return log (noisy no-op path).
This commit is contained in:
@@ -129,13 +129,11 @@ export class KoboSyncService {
|
||||
}
|
||||
|
||||
async invalidateSnapshot(userId: number) {
|
||||
const start = Date.now();
|
||||
const snapshot = await this.db.query.koboLibrarySnapshots.findFirst({
|
||||
where: eq(schema.koboLibrarySnapshots.userId, userId),
|
||||
});
|
||||
if (!snapshot) {
|
||||
this.logger.debug(`[kobo.snapshot] invalidate skipped userId=${userId} reason=no_snapshot`);
|
||||
return;
|
||||
}
|
||||
if (!snapshot) return;
|
||||
|
||||
const resetRows = await this.db
|
||||
.update(schema.koboSnapshotBooks)
|
||||
@@ -144,7 +142,7 @@ export class KoboSyncService {
|
||||
.returning({ bookId: schema.koboSnapshotBooks.bookId });
|
||||
|
||||
this.logger.debug(
|
||||
`[kobo.snapshot] invalidated userId=${userId} snapshotId=${snapshot.id} resetSyncedCount=${resetRows.length} bookIds=${resetRows.map((row) => row.bookId).join(',') || 'none'}`,
|
||||
`[kobo.snapshot.invalidate] [end] userId=${userId} snapshotId=${snapshot.id} durationMs=${Date.now() - start} resetSyncedCount=${resetRows.length} - snapshot invalidated`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user