calling entity_load_single() is an implicit call to load entity from Drupal static cache.
During cron and sf pull, this means Drupal might see stale entities - e.g. in parent-child relationships, or programmatic changes that do not invalidate the cache.

salesforce_pull_process_records() should load the entity from the database.

Comments

aaronbauman created an issue. See original summary.

aaronbauman’s picture

Status: Active » Needs review
StatusFileSize
new1 KB
mariacha1’s picture

Hey @aaronbauman -- it seems like this could cause a pretty big performance hit, particularly given that this cache reset is happening in a loop, and that every call with $reset=TRUE resets not just the current entity's cache, but the cache for all entities of that type.

How often does this situation really come up? If it's rare, could we make this a setting that could be enabled or disabled?

If it's a common problem, could we do a cache flush outside of the loop instead? Or only invalidate specific cache entries using something like entity_get_controller($entity_type)->resetCache(array($entity_id));?

aaronbauman’s picture

Status: Needs review » Needs work

invalidate specific cache entries using something like entity_get_controller($entity_type)->resetCache(array($entity_id));

This seems like a great idea.

In practice, I haven't noticed much hit to performance when running this patch.
I think because this happens only during cron, and cache is already getting cleared or has already been cleared.
Wouldn't hurt to be more targeted though.

aaronbauman’s picture

Component: Code » salesforce.module
Status: Needs work » Closed (won't fix)

7.x is no longer supported

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.