forked from platypush/platypush
Send an EntityUpdateEvent only if an entity has already been persisted
If an event comes from an entity that hasn't been persisted yet on the internal storage then we wait for the entity record to be committed before firing an event. It's better to wait a couple of seconds for the database to synchronize rather than dealing with entity events with incomplete objects.
This commit is contained in:
parent
67ff585f6c
commit
f17245e8c7
1 changed files with 1 additions and 1 deletions
|
@ -113,7 +113,7 @@ class EntitiesEngine(Thread):
|
|||
self.logger.info('Entities cache initialized')
|
||||
|
||||
def _process_event(self, entity: Entity):
|
||||
if self._entity_has_changes(entity):
|
||||
if self._entity_has_changes(entity) and entity.id:
|
||||
get_bus().post(EntityUpdateEvent(entity=entity))
|
||||
|
||||
def post(self, *entities: Entity):
|
||||
|
|
Loading…
Reference in a new issue