diff --git a/backend/src/helpers/ContactsCache.ts b/backend/src/helpers/ContactsCache.ts index a14af5d..44de800 100644 --- a/backend/src/helpers/ContactsCache.ts +++ b/backend/src/helpers/ContactsCache.ts @@ -4,7 +4,7 @@ import { type } from 'os' const unflatten = require('flat').unflatten var flatten = require('flat') import ListContactsServiceCache from "../services/ContactServices/ListContactsServiceCache" -import { redisConn } from './TicketCache' +import { deleteTicketsByContactsCache, redisConn } from './TicketCache' const deleteContactsByIdCache = async (id: string | number) => { @@ -18,9 +18,13 @@ const deleteContactsByIdCache = async (id: string | number) => { const contact_cache: any = await redis.hgetall(`contact:${id}`) try { - if (contact_cache && Object.keys(contact_cache).length > 0) { + if (contact_cache && Object.keys(contact_cache).length > 0) { - await redis.del(`contact:${id}`) + console.log('contact_cache["number"]: ',contact_cache['number']) + + await deleteTicketsByContactsCache(contact_cache['number']) + + await redis.del(`contact:${id}`) console.log(`Contacts cache number ${contact_cache['number']} deleted!`) } diff --git a/backend/src/helpers/TicketCache.ts b/backend/src/helpers/TicketCache.ts index 1554683..b09b31d 100644 --- a/backend/src/helpers/TicketCache.ts +++ b/backend/src/helpers/TicketCache.ts @@ -36,9 +36,18 @@ const redisConn = async () => { redis.on('connect', () => { + // console.log('CacheStore - Connection status: connected'); resolve(redis); }) + + redis.on('end', () => { + // console.log('CacheStore - Connection status: disconnected'); + }); + + redis.on('reconnecting', () => { + // console.log('CacheStore - Connection status: reconnecting'); + }); }); return await conn();