Skip to content

Commit

Permalink
fix: sqlite cleanup should use error not debug
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Nov 30, 2023
1 parent 13dd8c0 commit 56db1a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jobs/cleanup-sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const mountDir = config.env === 'production' ? '/mnt' : tmpdir;
// get total storage used for an alias (includes across all relevant domains/aliases)
const alias = await Aliases.findOne({ id });

if (!alias) throw new TypeError('Alias does not exist');
if (!alias) return;

// if the alias did not have imap or it was not enabled
// then we can return early since the check is not useful
Expand Down Expand Up @@ -236,7 +236,7 @@ const mountDir = config.env === 'production' ? '/mnt' : tmpdir;

const domain = await Domains.findById(alias.domain);

if (!domain) throw new TypeError('Domain does not exist');
if (!domain) return;

// get recipients and the majority favored locale
const { to, locale } = await Domains.getToAndMajorityLocaleByDomain(
Expand Down Expand Up @@ -280,7 +280,7 @@ const mountDir = config.env === 'production' ? '/mnt' : tmpdir;
alias.markModified('storage_thresholds_sent_at');
await alias.save();
} catch (err) {
logger.debug(err);
logger.error(err);
// commented out as a safeguard
// easy way to cleanup non-production environments tmpdir folders
// if (
Expand Down

0 comments on commit 56db1a9

Please sign in to comment.