Drop old unprocessed envelopes
This commit is contained in:
@@ -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>(
|
||||
`
|
||||
|
Reference in New Issue
Block a user