Skip to content

Commit

Permalink
fix(autsni): Fixed garbage collection for unfinished certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed May 2, 2024
1 parent 7ee5d06 commit 5bf6c86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cert-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const generateKeyPair = promisify(crypto.generateKeyPair);
const CERT_RENEW_TTL = 30 * 24 * 3600 * 1000;
const CERT_RENEW_DELAY = 24 * 3600 * 1000;
// delete uninitialized certificates after 1 day
const CERT_GARBAGE_TTL = 24 * 2300 * 1000;
const CERT_GARBAGE_TTL = 24 * 3600 * 1000;

class CertHandler {
constructor(options) {
Expand Down Expand Up @@ -117,7 +117,7 @@ class CertHandler {
let r = await this.database.collection('certs').deleteMany({
acme: true,
updated: {
$lt: new Date(Date.now() + CERT_GARBAGE_TTL)
$lt: new Date(Date.now() - CERT_GARBAGE_TTL)
},
$or: [{ expires: { $exists: false } }, { expires: { $lt: new Date() } }],
autogenerated: true
Expand Down

0 comments on commit 5bf6c86

Please sign in to comment.