Deleted all SingleUseTokens on boot

refs https://github.com/TryGhost/Team/issues/1216

Since we are increasing the grace period to 10 minutes, we want to make
sure that server crashes during those 10 minutes do not cause single use
tokens to remain in the system. The quickest was to ensure that without
restartable background jobs is to delete all tokens upon boot.
This commit is contained in:
Fabien O'Carroll 2022-01-04 10:21:36 +01:00
parent bfacca3035
commit 4d457461c9

View File

@ -175,6 +175,15 @@ const membersService = {
logging.error(err);
});
}
(async () => {
try {
const collection = await models.SingleUseToken.fetchAll();
await collection.invokeThen('destroy');
} catch (err) {
logging.error(err);
}
})();
},
contentGating: require('./content-gating'),