Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix: we should call .close() in async iterable (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT authored Oct 7, 2023
1 parent 627437a commit b9a82f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/async/handlers/tsonAsyncIterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ export const tsonAsyncIterator: TsonAsyncType<

switch (value[0]) {
case ITERATOR_DONE: {
opts.close();
return;
}

case ITERATOR_ERROR: {
opts.close();
throw TsonPromiseRejectionError.from(value[1]);
}

case ITERATOR_VALUE: {
yield value[1];
break;
break; // <-- breaks the switch, not the loop
}
}
}

opts.close();
})();
},
key: "AsyncIterable",
Expand Down

0 comments on commit b9a82f4

Please sign in to comment.