Drop old unprocessed envelopes
This commit is contained in:
parent
465b387a13
commit
71ca3c0764
3 changed files with 31 additions and 7 deletions
|
@ -3028,6 +3028,19 @@ async function getUnprocessedCount(): Promise<number> {
|
|||
|
||||
async function getAllUnprocessed(): Promise<Array<UnprocessedType>> {
|
||||
const db = getInstance();
|
||||
|
||||
const { changes: deletedCount } = db
|
||||
.prepare<Query>('DELETE FROM unprocessed WHERE timestamp < $monthAgo')
|
||||
.run({
|
||||
monthAgo: Date.now() - durations.MONTH,
|
||||
});
|
||||
|
||||
if (deletedCount !== 0) {
|
||||
logger.warn(
|
||||
`getAllUnprocessed: deleting ${deletedCount} old unprocessed envelopes`
|
||||
);
|
||||
}
|
||||
|
||||
const rows = db
|
||||
.prepare<EmptyQuery>(
|
||||
`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue