clarified var

This commit is contained in:
Brian Cao 2022-09-13 09:16:21 -07:00
parent 8e068310b8
commit c73d07d329

View File

@ -8,8 +8,8 @@ import clickhouse from 'lib/clickhouse';
export async function getSession(req) { export async function getSession(req) {
const { payload } = getJsonBody(req); const { payload } = getJsonBody(req);
const isRedis = redis.client; const hasRedis = redis.client;
const isClickhouse = clickhouse.client; const hasClickhouse = clickhouse.client;
if (!payload) { if (!payload) {
throw new Error('Invalid request'); throw new Error('Invalid request');
@ -34,7 +34,7 @@ export async function getSession(req) {
let websiteId = null; let websiteId = null;
// Check if website exists // Check if website exists
if (isRedis) { if (hasRedis) {
websiteId = Number(await redis.client.get(`website:${website_uuid}`)); websiteId = Number(await redis.client.get(`website:${website_uuid}`));
} }
@ -54,9 +54,9 @@ export async function getSession(req) {
let sessionId = null; let sessionId = null;
let session = null; let session = null;
if (!isClickhouse) { if (!hasClickhouse) {
// Check if session exists // Check if session exists
if (isRedis) { if (hasRedis) {
sessionId = Number(await redis.client.get(`session:${session_uuid}`)); sessionId = Number(await redis.client.get(`session:${session_uuid}`));
} }