Implement Couch Search and Request Batching (#3798)

* Implemented search in couch provider

* Promises, not await

* Batch requests

* Only batch if > 1

* Remove legacy Couch adapter

* Cleaned up couch request batching code

* Added test cases

* Code cleanup

* Changes to new and legacy objects API to remove redundant persists due to mutation of modified and persisted timestamps

* Cleaned up couch unit tests

Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
This commit is contained in:
Andrew Henry
2021-04-22 06:29:28 -07:00
committed by GitHub
parent 9fa71244ea
commit 564f254652
15 changed files with 273 additions and 871 deletions

View File

@ -76,7 +76,10 @@ class MutableDomainObject {
}
$set(path, value) {
_.set(this, path, value);
_.set(this, 'modified', Date.now());
if (path !== 'persisted' && path !== 'modified') {
_.set(this, 'modified', Date.now());
}
//Emit secret synchronization event first, so that all objects are in sync before subsequent events fired.
this._globalEventEmitter.emit(qualifiedEventName(this, '$_synchronize_model'), this);

View File

@ -520,8 +520,10 @@ ObjectAPI.prototype.getOriginalPath = function (identifier, path = []) {
*/
function hasAlreadyBeenPersisted(domainObject) {
return domainObject.persisted !== undefined
&& domainObject.persisted === domainObject.modified;
const result = domainObject.persisted !== undefined
&& domainObject.persisted >= domainObject.modified;
return result;
}
export default ObjectAPI;