Delete info on process

This commit is contained in:
Adria Navarro 2024-03-06 00:56:30 +01:00
parent a9046e9f26
commit 8e8378d1be
2 changed files with 14 additions and 0 deletions

View File

@ -108,4 +108,13 @@ export default class BaseCache {
throw err
}
}
/**
* Delete the entry if the provided value matches the stored one.
*/
async deleteIfValue(key: string, value: any, opts = { useTenancy: true }) {
key = opts.useTenancy ? generateTenantKey(key) : key
const client = await this.getClient()
await client.deleteIfValue(key, value)
}
}

View File

@ -66,6 +66,11 @@ docWritethroughProcessorQueue.process(async message => {
await persistToDb(cache, message.data)
console.log("DocWritethrough persisted", { data: message.data })
await cache.deleteIfValue(
REDIS_KEYS(cacheKeyPrefix).LATEST_MESSAGE_ID,
latestMessageId
)
}
)