Skip to content

Commit

Permalink
fix size
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Arregui committed Aug 24, 2022
1 parent eddafef commit bb0e590
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion etc/pushable-channel.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// @public
export function pushableChannel<T>(onIteratorClose: () => void): {
iterable: AsyncGenerator<T, any, unknown>;
bufferSize: () => () => number;
bufferSize: () => number;
push: (value: T, resolve: (err?: any) => void) => void;
close: () => void;
failAndClose: (errorToThrow: Error) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/push-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function pushableChannel<T>(onIteratorClose: () => void) {
}

function bufferSize() {
return queue.size
return queue.size()
}

function releaseLockIfNeeded() {
Expand Down
2 changes: 2 additions & 0 deletions test/push-channel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ describe("push channel", () => {
push(4)
])

expect(chan.bufferSize()).toEqual(5)

const takeAll = takeAsync(chan.iterable)
await jobs

Expand Down

0 comments on commit bb0e590

Please sign in to comment.