entities are now changed only if entity hash changed which will limit number of events emitted

This commit is contained in:
azivner
2018-08-12 20:04:48 +02:00
parent 13f524fb39
commit 9fb0599c45
8 changed files with 41 additions and 20 deletions

View File

@@ -60,6 +60,7 @@ async function updateEntity(entity) {
delete clone.jsonContent;
delete clone.isOwned;
delete clone.isChanged;
for (const key in clone) {
// !isBuffer is for images and attachments
@@ -73,7 +74,7 @@ async function updateEntity(entity) {
const primaryKey = entity[entity.constructor.primaryKeyName];
if (entity.constructor.tableName !== 'options' || entity.isSynced) {
if (entity.isChanged && (entity.constructor.tableName !== 'options' || entity.isSynced)) {
await syncTableService.addEntitySync(entity.constructor.tableName, primaryKey);
}
});