Skip to content

Commit 599f2e8

Browse files
fix: turn off debug logging for indexing and sync (#1081)
Logging these events produces a lot of output, which has a performance overhead. We need debug logging for debugging other issues, and currently we don't have a way to set log levels to selectively log this, so turning this off for now until we can filter logs by level. Co-authored-by: Mauve Signweaver <[email protected]>
1 parent ea57c50 commit 599f2e8

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/index-writer/index.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,18 @@ export class IndexWriter {
9797
const indexer = this.#indexers.get(schemaName)
9898
if (!indexer) continue // Won't happen, but TS doesn't know that
9999
indexer.batch(docs)
100-
if (this.#l.log.enabled) {
101-
for (const doc of docs) {
102-
this.#l.log(
103-
'Indexed %s %S @ %S',
104-
doc.schemaName,
105-
doc.docId,
106-
doc.versionId
107-
)
108-
}
109-
}
100+
// TODO: selectively turn this on when log level is 'trace' or 'debug'
101+
// Otherwise this has a big performance overhead because this is all synchronous
102+
// if (this.#l.log.enabled) {
103+
// for (const doc of docs) {
104+
// this.#l.log(
105+
// 'Indexed %s %S @ %S',
106+
// doc.schemaName,
107+
// doc.docId,
108+
// doc.versionId
109+
// )
110+
// }
111+
// }
110112
}
111113
return indexed
112114
}

src/sync/peer-sync-controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ export class PeerSyncController {
132132
const localState = mapObject(state, (ns, nsState) => {
133133
return [ns, nsState.localState]
134134
})
135-
this.#log('state %X', state)
135+
// TODO: Turn this on when log level is 'trace' or 'debug'
136+
// This logs _a lot_ of data, which has a performance overhead
137+
// this.#log('state %X', state)
136138

137139
// Map of which namespaces have received new data since last sync change
138140
const didUpdate = mapObject(state, (ns) => {

0 commit comments

Comments
 (0)