mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 05:17:35 +00:00
feat: add email test, fix memory leak (#24)
Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
EMAIL_USERNAME="youremail@gmail.com"
|
EMAIL_USERNAME="youremail@gmail.com"
|
||||||
EMAIL_PASSWORD="secretpassword"
|
EMAIL_PASSWORD="secretpassword"
|
||||||
|
EMAIL_TEST="true"
|
||||||
|
NOTIFICATION_METHODS="email"
|
||||||
SLACK_CHANNEL="SlackChannelName"
|
SLACK_CHANNEL="SlackChannelName"
|
||||||
SLACK_TOKEN="slack-token"
|
SLACK_TOKEN="slack-token"
|
||||||
STORES="bestbuy,bandh,nvidia"
|
STORES="bestbuy,bandh,nvidia"
|
||||||
NOTIFICATION_METHODS="email"
|
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,8 @@ config({path: resolve(__dirname, '../.env')});
|
|||||||
|
|
||||||
const email = {
|
const email = {
|
||||||
username: process.env.EMAIL_USERNAME,
|
username: process.env.EMAIL_USERNAME,
|
||||||
password: process.env.EMAIL_PASSWORD
|
password: process.env.EMAIL_PASSWORD,
|
||||||
|
test: process.env.EMAIL_TEST ?? 'false'
|
||||||
};
|
};
|
||||||
|
|
||||||
const notifications = {
|
const notifications = {
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ import open from 'open';
|
|||||||
import sendNotification from './notification';
|
import sendNotification from './notification';
|
||||||
import {Logger} from './logger';
|
import {Logger} from './logger';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send test email.
|
||||||
|
*/
|
||||||
|
if (Config.email.test === 'true') {
|
||||||
|
sendNotification('test');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the bot.
|
* Starts the bot.
|
||||||
*/
|
*/
|
||||||
@@ -45,6 +52,7 @@ async function lookup(store: Store) {
|
|||||||
await page.goto(link.url, {waitUntil: 'networkidle0'});
|
await page.goto(link.url, {waitUntil: 'networkidle0'});
|
||||||
} catch {
|
} catch {
|
||||||
Logger.error(`✖ [${store.name}] ${graphicsCard} skipping; timed out`);
|
Logger.error(`✖ [${store.name}] ${graphicsCard} skipping; timed out`);
|
||||||
|
await browser.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user