mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[doc-updater] add mongo logging to project notifications cron (#35421)
GitOrigin-RevId: db8a84f2079c57b5d5f1ae5447f8526dfb0a6d67
This commit is contained in:
@@ -104,6 +104,9 @@ async function main() {
|
||||
console.log(
|
||||
`Collaborator lookups: cacheHitWithCollaborators=${stats.collaboratorCacheHitWithCollaborators}, cacheHitNoCollaborators=${stats.collaboratorCacheHitNoCollaborators}, cacheMissWithCollaborators=${stats.collaboratorCacheMissWithCollaborators}, cacheMissNoCollaborators=${stats.collaboratorCacheMissNoCollaborators}, mongoQueries=${stats.collaboratorMongoQueries}`
|
||||
)
|
||||
console.log(
|
||||
`mongo-queries: ${formatDuration(stats.collaboratorMongoQueriesMs)} mongo_queries_ms=${stats.collaboratorMongoQueriesMs}`
|
||||
)
|
||||
|
||||
if (dryRun) {
|
||||
console.log('\n[DRY RUN] Projects that would be queued:')
|
||||
@@ -234,6 +237,7 @@ async function getProjectsWithCollaborators(
|
||||
batches.push(projectsNeedingMongoLookup.slice(i, i + MONGO_IN_BATCH_SIZE))
|
||||
}
|
||||
|
||||
const mongoQueriesStart = performance.now()
|
||||
const batchResults = await promiseMapWithLimit(
|
||||
MONGO_BATCH_CONCURRENCY,
|
||||
batches,
|
||||
@@ -256,6 +260,9 @@ async function getProjectsWithCollaborators(
|
||||
.toArray()
|
||||
}
|
||||
)
|
||||
stats.collaboratorMongoQueriesMs += Math.round(
|
||||
performance.now() - mongoQueriesStart
|
||||
)
|
||||
|
||||
const positives = new Set(
|
||||
batchResults.flatMap(docs => docs.map(d => d._id.toString()))
|
||||
@@ -294,6 +301,7 @@ type NotificationStats = {
|
||||
collaboratorCacheMissWithCollaborators: number
|
||||
collaboratorCacheMissNoCollaborators: number
|
||||
collaboratorMongoQueries: number
|
||||
collaboratorMongoQueriesMs: number
|
||||
}
|
||||
|
||||
async function getProjectsToNotify(): Promise<{
|
||||
@@ -317,6 +325,7 @@ async function getProjectsToNotify(): Promise<{
|
||||
collaboratorCacheMissWithCollaborators: 0,
|
||||
collaboratorCacheMissNoCollaborators: 0,
|
||||
collaboratorMongoQueries: 0,
|
||||
collaboratorMongoQueriesMs: 0,
|
||||
}
|
||||
let lastProgressLog = Date.now()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user