[Persistence] Break promise cycle

Break cyclical dependency in Promises that was causing persistence
to fall into an unresolvable state after overwrite, WTD-1033.
This commit is contained in:
Victor Woeltjen 2015-03-20 16:07:54 -07:00
parent b604af2aa7
commit f9b8b17ff6
2 changed files with 8 additions and 3 deletions

View File

@ -18,8 +18,12 @@ define(
function persist(failure) {
var decoratedPersistence =
failure.domainObject.getCapability('persistence');
return decoratedPersistence &&
decoratedPersistence.persist();
// Note that we issue the persist request here, but don't
// return it. We trust that the PersistenceQueue will
// behave correctly on the next round of flushing.
if (decoratedPersistence) {
decoratedPersistence.persist();
}
}
// Retry persistence (overwrite) for this set of failed attempts

View File

@ -50,7 +50,8 @@ define(
// Handle any failures from the full operation
function handleFailure(value) {
return failures.length > 0 ?
failureHandler.handle(failures) : value;
failureHandler.handle(failures) :
value;
}
// Try to persist everything, then handle any failures