-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Besides naming conventions driver -> connector. I replaced maybeVersion with a promise. The promise executes aynchrounsly on constructor, but it's awaited whenever the version is required, particularly to provide consistent health information. Otherwise isHealthy would be returning false, while the promise hasn't resolved yet. A potential optimization would be to consider the backend healthy unless we already awaited for the promise version and failed. That can help with coldstarts if if being healthy is a precondition to send queries.
- Loading branch information
Showing
11 changed files
with
47 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
query-engine/js-connectors/smoke-test-js/src/connector/util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
import { Closeable, Connector } from '../engines/types/Library.js'; | ||
|
||
// *.bind(db) is required to preserve the `this` context. | ||
// There are surely other ways than this to use class methods defined in JS within a | ||
// connector context, but this is the most straightforward. | ||
export const binder = (connector: Connector & Closeable): Connector & Closeable => ({ | ||
queryRaw: connector.queryRaw.bind(connector), | ||
executeRaw: connector.executeRaw.bind(connector), | ||
version: connector.version.bind(connector), | ||
isHealthy: connector.isHealthy.bind(connector), | ||
close: connector.close.bind(connector), | ||
}) |
83 changes: 0 additions & 83 deletions
83
query-engine/js-connectors/smoke-test-js/src/driver/mock.ts
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
query-engine/js-connectors/smoke-test-js/src/driver/util.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters