Skip to content

Commit

Permalink
Optimize stream metadata service by skipping validation
Browse files Browse the repository at this point in the history
  • Loading branch information
texuf committed Oct 22, 2024
1 parent e3e1c90 commit cc9d194
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/encryption/src/decryptionExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ export abstract class BaseDecryptionExtensions {

const { isValid, reason } = this.isValidEvent(streamId, item.solicitation.srcEventId)
if (!isValid) {
this.log.error('processing key solicitation: invalid event id', {
this.log.debug('processing key solicitation: invalid event id', {
streamId,
eventId: item.solicitation.srcEventId,
reason,
Expand Down
10 changes: 9 additions & 1 deletion packages/stream-metadata/src/riverStreamRpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import { FastifyBaseLogger } from 'fastify'
import { MediaContent, StreamIdHex } from './types'
import { getNodeForStream } from './streamRegistry'

const STREAM_METADATA_SERVICE_DEFAULT_UNPACK_OPTS: UnpackEnvelopeOpts = {
disableHashValidation: true,
disableSignatureValidation: true,
}

const clients = new Map<string, StreamRpcClient>()

export type StreamRpcClient = PromiseClient<typeof StreamService> & { url?: string }
Expand Down Expand Up @@ -180,7 +185,10 @@ export async function getStream(
'getStream finished',
)

const unpackedResponse = await unpackStream(response.stream, opts)
const unpackedResponse = await unpackStream(
response.stream,
opts ?? STREAM_METADATA_SERVICE_DEFAULT_UNPACK_OPTS,
)
return streamViewFromUnpackedResponse(streamId, unpackedResponse)
} catch (e) {
logger.error(
Expand Down

0 comments on commit cc9d194

Please sign in to comment.