Skip to content

Commit 377d5c4

Browse files
committed
Delete schema promise on error...
- Just because this way we can let the adapter an opportunity to yield a new error.... OR A SUCCESS
1 parent 867384f commit 377d5c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Controllers/DatabaseController.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ DatabaseController.prototype.validateClassName = function(className) {
110110
DatabaseController.prototype.loadSchema = function() {
111111
if (!this.schemaPromise) {
112112
this.schemaPromise = SchemaController.load(this.adapter);
113-
this.schemaPromise.then(() => delete this.schemaPromise);
113+
this.schemaPromise.then(() => delete this.schemaPromise,
114+
() => delete this.schemaPromise);
114115
}
115116
return this.schemaPromise;
116117
};
@@ -704,6 +705,7 @@ DatabaseController.prototype.find = function(className, query, {
704705
let aclGroup = acl || [];
705706
let op = typeof query.objectId == 'string' && Object.keys(query).length === 1 ? 'get' : 'find';
706707
let classExists = true;
708+
console.log('will load schema');
707709
return this.loadSchema()
708710
.then(schemaController => {
709711
//Allow volatile classes if querying with Master (for _PushStatus)
@@ -717,6 +719,7 @@ DatabaseController.prototype.find = function(className, query, {
717719
classExists = false;
718720
return { fields: {} };
719721
}
722+
console.log('Cannot get one schema');
720723
throw error;
721724
})
722725
.then(schema => {
@@ -767,6 +770,7 @@ DatabaseController.prototype.find = function(className, query, {
767770
if (!classExists) {
768771
return [];
769772
} else {
773+
console.log('adapter find');
770774
return this.adapter.find(className, schema, query, { skip, limit, sort })
771775
.then(objects => objects.map(object => {
772776
object = untransformObjectACL(object);

0 commit comments

Comments
 (0)