mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
[Persistence] Tweak logic
Tweak approach for revision conflict detection; particularly, use .reject instead of throw to avoid logging of the failure unnecessarily. WTD-1033.
This commit is contained in:
parent
d8e1f69b37
commit
b604af2aa7
@ -78,11 +78,11 @@ define(
|
||||
// Load the updated model, then reject the promise
|
||||
return get(key).then(function (model) {
|
||||
error.model = model;
|
||||
throw error;
|
||||
return $q.reject(error);
|
||||
});
|
||||
}
|
||||
// Reject the promise
|
||||
throw error;
|
||||
return $q.reject(error);
|
||||
}
|
||||
|
||||
// Check the response to a create/update/delete request;
|
||||
|
@ -34,16 +34,18 @@ define(
|
||||
return Object.keys(queue).length === lastObservedSize;
|
||||
}
|
||||
|
||||
// Clear the active promise for a queue flush
|
||||
function clearFlushPromise(value) {
|
||||
flushPromise = undefined;
|
||||
activeDefer.resolve(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
// Persist all queued objects
|
||||
function flush() {
|
||||
// Persist all queued objects
|
||||
flushPromise = handler.persist(queue, objects);
|
||||
|
||||
// When persisted, clear the active promise
|
||||
flushPromise.then(function (value) {
|
||||
flushPromise = undefined;
|
||||
activeDefer.resolve(value);
|
||||
});
|
||||
flushPromise = handler.persist(queue, objects)
|
||||
.then(clearFlushPromise, clearFlushPromise);
|
||||
|
||||
// Reset queue, etc.
|
||||
queue = {};
|
||||
|
Loading…
Reference in New Issue
Block a user