yeti-platform / yeti

Your Everyday Threat Intelligence
https://yeti-platform.io/
Apache License 2.0
1.74k stars 287 forks source link

Exclude related_observables_count from model_dump_json in save method #1134

Closed udgover closed 1 month ago

udgover commented 1 month ago

This PR fixes a performance issue when saving entities. This was introduced with Entity.related_observables_count computed field which is called each time an entity is saved. This means at each save call, neighbors method was also called. This mainly impacts feeds or tasks creating / updating lots of entities.

Fixing this issue relies on excluding related_observables_count when calling model_json_dump in ArangoDatabase.save method.