mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 01:47:39 +00:00
@@ -14,7 +14,7 @@ import {sendTelegramMessage} from './telegram';
|
||||
import {sendTweet} from './twitter';
|
||||
import {sendTwilioMessage} from './twilio';
|
||||
import {sendTwitchMessage} from './twitch';
|
||||
import updateRedis from './redis';
|
||||
import {updateRedis} from './redis';
|
||||
|
||||
export function sendNotification(link: Link, store: Store) {
|
||||
// Priority
|
||||
|
||||
@@ -4,19 +4,18 @@ import {config} from '../config';
|
||||
import {logger} from '../logger';
|
||||
|
||||
const {url} = config.notifications.redis;
|
||||
let client: RedisClient;
|
||||
|
||||
function initRedis(): RedisClient | null {
|
||||
if (url) {
|
||||
return redis.createClient({url});
|
||||
client = redis.createClient({url});
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function updateRedis(link: Link, store: Store) {
|
||||
export function updateRedis(link: Link, store: Store) {
|
||||
try {
|
||||
const client = initRedis();
|
||||
|
||||
if (client) {
|
||||
const key = `${store.name}:${link.brand}:${link.model}`
|
||||
.split(' ')
|
||||
@@ -43,4 +42,4 @@ function updateRedis(link: Link, store: Store) {
|
||||
}
|
||||
}
|
||||
|
||||
export default updateRedis;
|
||||
initRedis();
|
||||
|
||||
Reference in New Issue
Block a user