Skip to content

Commit

Permalink
fix: added IP to query in sending emails
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Aug 29, 2023
1 parent 8bf4bb6 commit 20d3b67
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jobs/send-emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const Graceful = require('@ladjs/graceful');
const Redis = require('@ladjs/redis');
const dayjs = require('dayjs-with-plugins');
const delay = require('delay');
const ip = require('ip');
const mongoose = require('mongoose');
const parseErr = require('parse-err');
const sharedConfig = require('@ladjs/shared-config');
Expand All @@ -24,7 +25,9 @@ const emailHelper = require('#helpers/email');
const logger = require('#helpers/logger');
const processEmail = require('#helpers/process-email');
const setupMongoose = require('#helpers/setup-mongoose');
const getBlockedHashes = require('#helpers/get-blocked-hashes');

const IP_ADDRESS = ip.address();
const breeSharedConfig = sharedConfig('BREE');
const client = new Redis(breeSharedConfig.redis, logger);
const resolver = createTangerine(client, logger);
Expand Down Expand Up @@ -93,7 +96,10 @@ async function sendEmails() {
$gte: dayjs().subtract(1, 'hour').toDate(),
$lte: now
},
has_blocked_hashes: true
has_blocked_hashes: true,
blocked_hashes: {
$in: getBlockedHashes(IP_ADDRESS)
}
})
]);

Expand Down

0 comments on commit 20d3b67

Please sign in to comment.