Skip to content

Commit a460cad

Browse files
authored
Merge pull request #151 from ebebbington/issue-#127-expose-ready
[#127] Expose and rename _ready prop on Pool class
2 parents e13d429 + 84ccfff commit a460cad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pool.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class Pool {
1313
private _connections!: Array<Connection>;
1414
private _availableConnections!: DeferredStack<Connection>;
1515
private _maxSize: number;
16-
private _ready: Promise<void>;
16+
public ready: Promise<void>;
1717
private _lazy: boolean;
1818

1919
constructor(
@@ -24,7 +24,7 @@ export class Pool {
2424
this._connectionParams = createParams(connectionParams);
2525
this._maxSize = maxSize;
2626
this._lazy = !!lazy;
27-
this._ready = this._startup();
27+
this.ready = this._startup();
2828
}
2929

3030
private async _createConnection(): Promise<Connection> {
@@ -69,7 +69,7 @@ export class Pool {
6969
}
7070

7171
private async _execute(query: Query): Promise<QueryResult> {
72-
await this._ready;
72+
await this.ready;
7373
const connection = await this._availableConnections.pop();
7474
try {
7575
const result = await connection.query(query);
@@ -82,7 +82,7 @@ export class Pool {
8282
}
8383

8484
async connect(): Promise<PoolClient> {
85-
await this._ready;
85+
await this.ready;
8686
const connection = await this._availableConnections.pop();
8787
const release = () => this._availableConnections.push(connection);
8888
return new PoolClient(connection, release);
@@ -99,7 +99,7 @@ export class Pool {
9999
}
100100

101101
async end(): Promise<void> {
102-
await this._ready;
102+
await this.ready;
103103
while (this.available > 0) {
104104
const conn = await this._availableConnections.pop();
105105
await conn.end();

0 commit comments

Comments
 (0)