chore: remove pre-fetch from transaction store

This commit is contained in:
Adhiraj Singh
2022-10-09 12:19:33 +05:30
parent eb2590bc6c
commit 7736114fab
2 changed files with 0 additions and 10 deletions

View File

@@ -76,7 +76,6 @@ export type SignalKeyStore = {
export type SignalKeyStoreWithTransaction = SignalKeyStore & {
isInTransaction: () => boolean
transaction(exec: () => Promise<void>): Promise<void>
prefetch<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Promise<void>
}
export type TransactionCapabilityOptions = {

View File

@@ -1,4 +1,3 @@
import { Boom } from '@hapi/boom'
import { randomBytes } from 'crypto'
import NodeCache from 'node-cache'
import type { Logger } from 'pino'
@@ -97,10 +96,6 @@ export const addTransactionCapability = (
* useful if these data points will be used together often
* */
const prefetch = async(type: keyof SignalDataTypeMap, ids: string[]) => {
if(!inTransaction) {
throw new Boom('Cannot prefetch without transaction')
}
const dict = transactionCache[type]
const idsRequiringFetch = dict ? ids.filter(item => !(item in dict)) : ids
// only fetch if there are any items to fetch
@@ -145,10 +140,6 @@ export const addTransactionCapability = (
}
},
isInTransaction: () => inTransaction,
prefetch: (type, ids) => {
logger.trace({ type, ids }, 'prefetching')
return prefetch(type, ids)
},
transaction: async(work) => {
// if we're already in a transaction,
// just execute what needs to be executed -- no commit required