Skip to content

Commit

Permalink
refactor(utils/stream): stream pull (#2057)
Browse files Browse the repository at this point in the history
  • Loading branch information
ariskemper authored Jan 23, 2024
1 parent 45d612d commit 0802633
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions deno_dist/utils/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ export class StreamingApi {
this.responseReadable = new ReadableStream({
async pull(controller) {
const { done, value } = await reader.read()
if (done) {
controller.close()
} else {
controller.enqueue(value)
}
done ? controller.close() : controller.enqueue(value)
},
cancel: () => {
this.abortSubscribers.forEach((subscriber) => subscriber())
Expand Down
6 changes: 1 addition & 5 deletions src/utils/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ export class StreamingApi {
this.responseReadable = new ReadableStream({
async pull(controller) {
const { done, value } = await reader.read()
if (done) {
controller.close()
} else {
controller.enqueue(value)
}
done ? controller.close() : controller.enqueue(value)
},
cancel: () => {
this.abortSubscribers.forEach((subscriber) => subscriber())
Expand Down

0 comments on commit 0802633

Please sign in to comment.