Reuse connection in getAllClasses (#4463)

as per the title.
This commit is contained in:
Vitaly Tomilov
2017-12-27 20:44:11 +00:00
committed by GitHub
parent 5681b3f902
commit b4aca8afc9

View File

@@ -856,8 +856,11 @@ export class PostgresStorageAdapter {
// schemas cannot be retrieved, returns a promise that rejects. Requirements for the
// rejection reason are TBD.
getAllClasses() {
return this._ensureSchemaCollectionExists()
.then(() => this._client.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema })));
const self = this;
return this._client.task('get-all-classes', function * (t) {
yield self._ensureSchemaCollectionExists(t);
return yield t.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema }));
});
}
// Return a promise for the schema with the given name, in Parse format. If