mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 13:27:38 +00:00
@@ -1,17 +1,23 @@
|
|||||||
import {Link, Store} from '../store/model';
|
import {Link, Store} from '../store/model';
|
||||||
|
import redis, {RedisClient} from 'redis';
|
||||||
import {config} from '../config';
|
import {config} from '../config';
|
||||||
import {logger} from '../logger';
|
import {logger} from '../logger';
|
||||||
import redis from 'redis';
|
|
||||||
|
|
||||||
const {url} = config.notifications.redis;
|
const {url} = config.notifications.redis;
|
||||||
|
|
||||||
const client = redis.createClient({
|
function initRedis(): RedisClient | null {
|
||||||
url
|
if (url) {
|
||||||
});
|
return redis.createClient({url});
|
||||||
|
}
|
||||||
|
|
||||||
const updateRedis = (link: Link, store: Store) => {
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateRedis(link: Link, store: Store) {
|
||||||
try {
|
try {
|
||||||
if (url) {
|
const client = initRedis();
|
||||||
|
|
||||||
|
if (client) {
|
||||||
const key = `${store.name}:${link.brand}:${link.model}`
|
const key = `${store.name}:${link.brand}:${link.model}`
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.join('-');
|
.join('-');
|
||||||
@@ -35,6 +41,6 @@ const updateRedis = (link: Link, store: Store) => {
|
|||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't update redis", error);
|
logger.error("✖ couldn't update redis", error);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default updateRedis;
|
export default updateRedis;
|
||||||
|
|||||||
Reference in New Issue
Block a user