mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
#6768: the recovery scan retried every pending activity notification each round, and one whose delivery fails for good - its activity deleted or changed since, a recipient who lost access, a plan with nothing or too much to send - failed the same way every round, forever, so the list only grew. Such an error is terminal now: after a ten-minute grace (an activity being written is never touched) the scan cancels that notification through the same cancellation an administrator uses, as the system, which compacts it to a cancelled receipt. A pending notification older than ACTIVITY_NOTIFICATION_MAX_AGE_DAYS (7) is cancelled as expired instead of being delivered a week late. Network and other transient failures are still retried. Admin Panel -> Problems gets "Retry all" and "Cancel older..." for the whole list at once, site administrators only. #6769: before each run synced-cron asks whether a job of that name is still running - { name, finishedAt: { $exists: false } } - every minute for every job on every instance, and only { intendedAt, name } and the TTL on startedAt were indexed, so it scanned the job history. { name, finishedAt } is created at startup with WeKan's ensureIndex. The new strings are translated in every locale. Thanks to Raymond-Voogt and xet7 ! Fixes #6768, Fixes #6769.
15 lines
796 B
JavaScript
15 lines
796 B
JavaScript
'use strict';
|
|
|
|
// Guard: #6769 - synced-cron's per-minute running-job lookup is indexed.
|
|
// Run: node tests/syncedCronIndex.test.cjs
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const src = fs.readFileSync(path.join(__dirname, '..', 'server/cron/syncedCron.js'), 'utf8');
|
|
assert.match(src, /export const CRON_RUNNING_JOB_INDEX = \{ name: 1, finishedAt: 1 \};/);
|
|
assert.match(src, /return await ensureIndex\(collection, CRON_RUNNING_JOB_INDEX\);/);
|
|
assert.match(src, /startSyncedCron\(\);\s*\/\/[^\n]*\n[^\n]*\n\s*if \(!\(await ensureCronIndexes\(\)\)/);
|
|
// negative: the job history keeps its TTL (the index must not replace it)
|
|
assert.match(src, /collectionTTL: 172800/);
|
|
console.log('ok - the running-job lookup has its index, created at startup');
|