diff --git a/packages/swing-store-lmdb/src/sqlStreamStore.js b/packages/swing-store-lmdb/src/sqlStreamStore.js index 5166df5add1..23d3a1cc341 100644 --- a/packages/swing-store-lmdb/src/sqlStreamStore.js +++ b/packages/swing-store-lmdb/src/sqlStreamStore.js @@ -113,10 +113,9 @@ export function sqlStreamStore(dbDir, io) { insistStreamPosition(position); assert( - [undefined, 'writing'].includes(streamStatus.get(streamName)), + !streamStatus.get(streamName), X`can't write stream ${q(streamName)} because it's already in use`, ); - streamStatus.set(streamName, 'writing'); db.prepare( ` diff --git a/packages/swing-store-lmdb/test/test-state.js b/packages/swing-store-lmdb/test/test-state.js index 9e88982e87d..0bdf7f9172b 100644 --- a/packages/swing-store-lmdb/test/test-state.js +++ b/packages/swing-store-lmdb/test/test-state.js @@ -121,10 +121,6 @@ test('streamStore mode interlock', t => { const start = streamStore.STREAM_START; const s1pos = streamStore.writeStreamItem('st1', 'first', start); - - t.throws(() => streamStore.readStream('st1', start, s1pos), { - message: `can't read stream "st1" because it's already in use`, - }); streamStore.closeStream('st1'); const reader = streamStore.readStream('st1', start, s1pos); diff --git a/packages/swing-store-simple/src/simpleSwingStore.js b/packages/swing-store-simple/src/simpleSwingStore.js index 06188e57f2a..9ab07b56751 100644 --- a/packages/swing-store-simple/src/simpleSwingStore.js +++ b/packages/swing-store-simple/src/simpleSwingStore.js @@ -228,18 +228,12 @@ export function initSimpleSwingStore() { let stream = streams.get(streamName); if (!stream) { stream = []; - streamStatus.set(streamName, 'write'); streams.set(streamName, stream); } else { - const status = streamStatus.get(streamName); - if (!status) { - streamStatus.set(streamName, 'write'); - } else { - assert( - status === 'write', - X`can't write stream ${q(streamName)} because it's already in use`, - ); - } + assert( + !streamStatus.get(streamName), + X`can't write stream ${q(streamName)} because it's already in use`, + ); } stream[position.itemCount] = item; return harden({ itemCount: position.itemCount + 1 });