Skip to content

Commit 26fb4e6

Browse files
vitaly-tflovilmart
authored andcommitted
Reuse connection in getAllClasses (#4463)
as per the title.
1 parent ac6a382 commit 26fb4e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,11 @@ export class PostgresStorageAdapter implements StorageAdapter {
863863
// schemas cannot be retrieved, returns a promise that rejects. Requirements for the
864864
// rejection reason are TBD.
865865
getAllClasses() {
866-
return this._ensureSchemaCollectionExists()
867-
.then(() => this._client.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema })));
866+
const self = this;
867+
return this._client.task('get-all-classes', function * (t) {
868+
yield self._ensureSchemaCollectionExists(t);
869+
return yield t.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema }));
870+
});
868871
}
869872

870873
// Return a promise for the schema with the given name, in Parse format. If

0 commit comments

Comments
 (0)