Skip to content

Commit 452a30d

Browse files
committed
Fix deno partial writes
,,
1 parent 0925baa commit 452a30d

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

cjs/tests/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,8 @@ t('has server parameters', async() => {
784784

785785
t('big query body', async() => {
786786
await sql`create table test (x int)`
787-
return [1000, (await sql`insert into test ${
788-
sql([...Array(1000).keys()].map(x => ({ x })))
787+
return [50000, (await sql`insert into test ${
788+
sql([...Array(50000).keys()].map(x => ({ x })))
789789
}`).count, await sql`drop table test`]
790790
})
791791

deno/polyfills.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ export const net = {
6969
socket.events[x] = socket.events[x].filter(x => x !== fn && x.once !== fn)
7070
},
7171
write: (x, cb) => {
72-
socket.raw.write(x)
73-
.then(() => (cb && cb(null)))
74-
.catch(err => {
75-
cb && cb()
76-
call(socket.events.error, err)
77-
})
72+
socket.raw.write(x).then(l => {
73+
l < x.length
74+
? socket.write(x.slice(l), cb)
75+
: (cb && cb(null))
76+
}).catch(err => {
77+
cb && cb()
78+
call(socket.events.error, err)
79+
})
7880
return false
7981
},
8082
destroy: () => close(),

deno/tests/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ t('has server parameters', async() => {
786786

787787
t('big query body', async() => {
788788
await sql`create table test (x int)`
789-
return [1000, (await sql`insert into test ${
790-
sql([...Array(1000).keys()].map(x => ({ x })))
789+
return [50000, (await sql`insert into test ${
790+
sql([...Array(50000).keys()].map(x => ({ x })))
791791
}`).count, await sql`drop table test`]
792792
})
793793

tests/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,8 @@ t('has server parameters', async() => {
784784

785785
t('big query body', async() => {
786786
await sql`create table test (x int)`
787-
return [1000, (await sql`insert into test ${
788-
sql([...Array(1000).keys()].map(x => ({ x })))
787+
return [50000, (await sql`insert into test ${
788+
sql([...Array(50000).keys()].map(x => ({ x })))
789789
}`).count, await sql`drop table test`]
790790
})
791791

0 commit comments

Comments
 (0)