feat: add email test, fix memory leak (#24)

Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
DakkJaniels
2020-09-18 18:06:40 -04:00
committed by GitHub
parent c0a881a16e
commit a2fb97333c
3 changed files with 12 additions and 2 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
EMAIL_USERNAME="youremail@gmail.com"
EMAIL_PASSWORD="secretpassword"
EMAIL_TEST="true"
NOTIFICATION_METHODS="email"
SLACK_CHANNEL="SlackChannelName"
SLACK_TOKEN="slack-token"
STORES="bestbuy,bandh,nvidia"
NOTIFICATION_METHODS="email"
+2 -1
View File
@@ -5,7 +5,8 @@ config({path: resolve(__dirname, '../.env')});
const email = {
username: process.env.EMAIL_USERNAME,
password: process.env.EMAIL_PASSWORD
password: process.env.EMAIL_PASSWORD,
test: process.env.EMAIL_TEST ?? 'false'
};
const notifications = {
+8
View File
@@ -5,6 +5,13 @@ import open from 'open';
import sendNotification from './notification';
import {Logger} from './logger';
/**
* Send test email.
*/
if (Config.email.test === 'true') {
sendNotification('test');
}
/**
* Starts the bot.
*/
@@ -45,6 +52,7 @@ async function lookup(store: Store) {
await page.goto(link.url, {waitUntil: 'networkidle0'});
} catch {
Logger.error(`✖ [${store.name}] ${graphicsCard} skipping; timed out`);
await browser.close();
return;
}