Skip to content

Commit 1a123b9

Browse files
committed
fix: First collect, then notify
1 parent 1c4965c commit 1a123b9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/commands/Check.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,17 @@ export default class extends Command {
5252

5353
const notification = new Notification(configuration, options.smtpTransportUrl, confluence, null, options.dryRun)
5454

55+
const checkedDocuments = []
56+
5557
for (const check of configuration.checks) {
5658
log.debug(`Checking for documents older than ${check.maxAge} day(s) with label(s) ${check.labels.join(',')}`)
5759
let filter = `label = ${check.labels.join('AND label = ')}`
5860
if (configuration.space && configuration.space != '') {
5961
filter = `${filter} AND space = ${configuration.space}`
6062
}
61-
const checkedDocuments = await confluence.findDocumentsOlderThan(filter, check.maxAge)
62-
63-
await notification.notify(checkedDocuments)
63+
checkedDocuments.push(...(await confluence.findDocumentsOlderThan(filter, check.maxAge)))
6464
}
65+
66+
await notification.notify(checkedDocuments)
6567
}
6668
}

0 commit comments

Comments
 (0)