Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Dliu/pg browser #2

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bc922a2
Changes for websockets and cursors
daniel-liu-bitio Feb 22, 2022
86558d2
Add pg browser
daniel-liu-bitio Feb 28, 2022
a8d4e8f
Clean up webpack config file
daniel-liu-bitio Feb 28, 2022
b22bd76
Merge branch 'master' into dliu/pg-browser
daniel-liu-bitio Feb 28, 2022
5346973
Fix yarn.lock
daniel-liu-bitio Feb 28, 2022
ab56adf
Modify pg tests
daniel-liu-bitio Mar 1, 2022
e0506b7
Update packages/pg-cursor/index.js
daniel-liu-bitio Mar 1, 2022
096c823
Comment clarifications
daniel-liu-bitio Mar 1, 2022
7fae74e
Remove yarn.loc
daniel-liu-bitio Mar 1, 2022
aa6fcf4
Fix pg test defaults and comment clarifications
daniel-liu-bitio Mar 1, 2022
e3adc69
Update packages/pg-cursor/index.js
daniel-liu-bitio Mar 2, 2022
db91f5b
Merge branch 'dliu/pg-browser' of https://github.com/daniel-liu-bitio…
daniel-liu-bitio Mar 2, 2022
70880de
Add comment to connection.end
daniel-liu-bitio Mar 2, 2022
7b6c17b
Add back original IP/hostname functionality
daniel-liu-bitio Mar 2, 2022
ff56d38
Add 130-tests.js back into test suite
daniel-liu-bitio Mar 2, 2022
42e05cc
Restore original integration/connection/test-helper
daniel-liu-bitio Mar 2, 2022
b58ec5c
Change some devDependencies back to dependencies
daniel-liu-bitio Mar 2, 2022
62dde3f
Remove status message logging
daniel-liu-bitio Mar 3, 2022
b55e00d
Fix stream placeholder logic
daniel-liu-bitio Mar 3, 2022
8462ab8
Send closing code + status on connection end
daniel-liu-bitio Mar 7, 2022
2f4a80d
Remove commented out original tests
daniel-liu-bitio Mar 9, 2022
f05b81c
Add simple performance test file
daniel-liu-bitio Mar 14, 2022
b7eae9d
Add cursor -> select example
daniel-liu-bitio Mar 14, 2022
d622ec7
Add yarn.lock
daniel-liu-bitio Mar 14, 2022
7b10504
Add messages.d.ts
daniel-liu-bitio Mar 14, 2022
e915f5d
recent
daniel-liu-bitio Mar 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix stream placeholder logic
  • Loading branch information
daniel-liu-bitio committed Mar 3, 2022
commit b55e00d89a85b427c19c59674407fbee32db36b1
2 changes: 1 addition & 1 deletion packages/pg/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class Client extends EventEmitter {
// if we have an active query we need to force a disconnect
// on the socket - otherwise a hung query could block end forever
this.connection.stream.destroy()
} else if (this.connection._connecting) {
} else {
this.connection.end()
}

Expand Down
7 changes: 4 additions & 3 deletions packages/pg/lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class Connection extends EventEmitter {
constructor(config) {
super()
config = config || {}
this.stream = config.stream // possibly null, try to lazily load on connect
this.placeholderStream = false
if(!config.stream) {
this.stream = config.stream // possibly null: if so, temporarily use placeholder and lazily make the stream on connect()
// since websocketstream attempts to connect on construction
if(!this.stream) {
var placeholder = {
once: function(){},
on: function(){},
Expand All @@ -31,7 +32,7 @@ class Connection extends EventEmitter {
}
}
}
config.stream = placeholder
this.stream = placeholder
this.placeholderStream = true
}
this.lastBuffer = false
Expand Down