diff --git a/packages/utils/src/storage.ts b/packages/utils/src/storage.ts index 99925108..f184ae22 100644 --- a/packages/utils/src/storage.ts +++ b/packages/utils/src/storage.ts @@ -170,11 +170,11 @@ export class BlockStorage implements Blocks, Startable { } } - async createSession (root: CID, options?: AbortOptions): Promise { + async createSession (root: CID, options?: AbortOptions): Promise { const releaseLock = await this.lock.readLock() try { - const blocks = await this.child.createSession?.(root, options) + const blocks = await this.child.createSession(root, options) if (blocks == null) { throw new CodeError('Sessions not supported', 'ERR_UNSUPPORTED') diff --git a/packages/utils/src/utils/networked-storage.ts b/packages/utils/src/utils/networked-storage.ts index 3f012174..57b58c78 100644 --- a/packages/utils/src/utils/networked-storage.ts +++ b/packages/utils/src/utils/networked-storage.ts @@ -83,10 +83,6 @@ export class NetworkedStorage implements Blocks, Startable { this.blockBrokers.map(async broker => broker.announce?.(cid, block, options)) ) - await Promise.all( - this.blockBrokers.map(async broker => broker.announce?.(cid, block, options)) - ) - options.onProgress?.(new CustomProgressEvent('blocks:put:blockstore:put', cid)) return this.child.put(cid, block, options) diff --git a/packages/utils/test/storage.spec.ts b/packages/utils/test/storage.spec.ts index db93c844..42c5a5b4 100644 --- a/packages/utils/test/storage.spec.ts +++ b/packages/utils/test/storage.spec.ts @@ -12,8 +12,15 @@ import { BlockStorage } from '../src/storage.js' import { createBlock } from './fixtures/create-block.js' import type { Blocks } from '@helia/interface' import type { Pins } from '@helia/interface/pins' +import type { Blockstore } from 'interface-blockstore' import type { CID } from 'multiformats/cid' +class MemoryBlocks extends MemoryBlockstore implements Blocks { + async createSession (): Promise { + throw new Error('Not implemented') + } +} + describe('storage', () => { let storage: BlockStorage let blockstore: Blocks @@ -29,7 +36,7 @@ describe('storage', () => { const datastore = new MemoryDatastore() - blockstore = new MemoryBlockstore() + blockstore = new MemoryBlocks() pins = new PinsImpl(datastore, blockstore, []) storage = new BlockStorage(blockstore, pins, { holdGcLock: true