fix: optimize LID migration performance and introduce cache (#1782)
* chore: lid-map cache, bulk migration, fixes * fix: type error * fix: signalrepository with lid type, remove check from assertsessions, lid-mapping store level deduplication * fix: migrations logs * fix: remove migrationsops lenght check * fix: skip deletesession if cached or existing migrations * chore: remove check migrated session * fix: remove return null loadsession * fix: getLIDforPN call and jidsrequiringfetch * fix: longer lid map cache TTL * fix: lint * fix: lid type * fix: lid socket type
This commit is contained in:
@@ -10,7 +10,7 @@ import type {
|
||||
RequestJoinAction,
|
||||
RequestJoinMethod,
|
||||
SignalKeyStoreWithTransaction,
|
||||
SignalRepository
|
||||
SignalRepositoryWithLIDStore
|
||||
} from '../Types'
|
||||
import { WAMessageStubType } from '../Types'
|
||||
import { getContentType, normalizeMessageContent } from '../Utils/messages'
|
||||
@@ -28,7 +28,7 @@ type ProcessMessageContext = {
|
||||
ev: BaileysEventEmitter
|
||||
logger?: ILogger
|
||||
options: AxiosRequestConfig<{}>
|
||||
signalRepository: SignalRepository
|
||||
signalRepository: SignalRepositoryWithLIDStore
|
||||
}
|
||||
|
||||
const REAL_MSG_STUB_TYPES = new Set([
|
||||
@@ -304,7 +304,6 @@ const processMessage = async (
|
||||
])
|
||||
break
|
||||
case proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC:
|
||||
const lidMappingStore = signalRepository.getLIDMappingStore()
|
||||
const encodedPayload = protocolMsg.lidMigrationMappingSyncMessage?.encodedMappingPayload!
|
||||
const { pnToLidMappings, chatDbMigrationTimestamp } =
|
||||
proto.LIDMigrationMappingSyncPayload.decode(encodedPayload)
|
||||
@@ -315,7 +314,7 @@ const processMessage = async (
|
||||
pairs.push({ lid: `${lid}@lid`, pn: `${pn}@s.whatsapp.net` })
|
||||
}
|
||||
|
||||
await lidMappingStore.storeLIDPNMappings(pairs)
|
||||
await signalRepository.lidMapping.storeLIDPNMappings(pairs)
|
||||
}
|
||||
} else if (content?.reactionMessage) {
|
||||
const reaction: proto.IReaction = {
|
||||
|
||||
Reference in New Issue
Block a user