File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
packages/core/src/components/messageStore/node Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -323,9 +323,25 @@ class SqliteMessageStore implements MessageStore {
323
323
) : AsyncIterable < [ Uint8Array , Message ] > {
324
324
const { type, limit, app } = filter
325
325
if ( type === undefined ) {
326
- yield * this . getSessionStream ( { limit, app } )
327
- yield * this . getActionStream ( { limit, app } )
328
- yield * this . getCustomActionStream ( { limit, app } )
326
+ const countMax = limit ?? Infinity
327
+ let count = 0
328
+ for await ( const session of this . getSessionStream ( { limit, app } ) ) {
329
+ if ( count ++ < countMax ) {
330
+ yield session
331
+ }
332
+ }
333
+
334
+ for await ( const session of this . getActionStream ( { limit, app } ) ) {
335
+ if ( count ++ < countMax ) {
336
+ yield session
337
+ }
338
+ }
339
+
340
+ for await ( const session of this . getCustomActionStream ( { limit, app } ) ) {
341
+ if ( count ++ < countMax ) {
342
+ yield session
343
+ }
344
+ }
329
345
} else if ( type === "session" ) {
330
346
yield * this . getSessionStream ( { limit, app } )
331
347
} else if ( type === "action" ) {
You can’t perform that action at this time.
0 commit comments