Skip to content

Commit b4aca8a

Browse files
authored
Reuse connection in getAllClasses (#4463)
as per the title.
1 parent 5681b3f commit b4aca8a

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
@@ -856,8 +856,11 @@ export class PostgresStorageAdapter {
856856
// schemas cannot be retrieved, returns a promise that rejects. Requirements for the
857857
// rejection reason are TBD.
858858
getAllClasses() {
859-
return this._ensureSchemaCollectionExists()
860-
.then(() => this._client.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema })));
859+
const self = this;
860+
return this._client.task('get-all-classes', function * (t) {
861+
yield self._ensureSchemaCollectionExists(t);
862+
return yield t.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema }));
863+
});
861864
}
862865

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

0 commit comments

Comments
 (0)