Skip to content

Commit

Permalink
[pinpoint-apm#183] Fix axios node@20 an Error on Test
Browse files Browse the repository at this point in the history
  • Loading branch information
feelform committed Apr 18, 2024
1 parent ac009bd commit b5a0125
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 77 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
node_version:
- 16
- 18
- 20

name: Node ${{ matrix.node_version }} on ubuntu-latest
steps:
Expand Down
12 changes: 6 additions & 6 deletions lib/client/bounded-buffer-readable-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ class BoundedBufferReadableStream {
})

readableStream.on('close', () => {
if (!this.writableFactory) {
return
}

this.readableStream = this.makeReadableSteam()
this._pipe()
this.needsNewReadableStream = true
})

return readableStream
Expand All @@ -63,6 +58,11 @@ class BoundedBufferReadableStream {
}

readStart() {
if (this.needsNewReadableStream) {
this.readableStream = this.makeReadableSteam()
this._pipe()
}

this.readable = true

const length = this.buffer.length
Expand Down
108 changes: 54 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/client/bounded-buffer-readable-stream.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ test('reconnect writable stream on piped readable stream', (t) => {

test('If the Readable stream emits an error during processing, the writable destination is not closed automatically. If an error occurs, Close each streams, ', async (t) => {
if (semver.satisfies(process.versions.node, '<17.0')) {
t.plan(16)
t.plan(15)
} else {
t.plan(19)
t.plan(18)
}

const readable = new BoundedBufferReadableStream()
Expand All @@ -149,7 +149,7 @@ test('If the Readable stream emits an error during processing, the writable dest
t.true(this.destroyed, 'destroyed property is true on close event of readable steam')

// recovery readable steam
t.true(readable.readableStream.readable, 'readable property is true on close event of recovery readable steam after error')
// t.true(readable.readableStream.readable, 'readable property is true on close event of recovery readable steam after error')
})

t.equal(readable.buffer[0], 'test1', 'buffer[0] is test1')
Expand Down

0 comments on commit b5a0125

Please sign in to comment.