I committed a couple of changes to user_relationships_api.inc:

  1. The user_relationships_update_relationship() function was doing a db DELETE/INSERT, instead of a db UDPATE to update relationships. This meant the rid of a relationship changed every time the relationship was updated. This could cause a problem for other modules that use the rid to identify relationships. The function now does an UPDATE and preserves the rid.
  2. The user_relationships_load_all_for_user() function was blindly caching the results of every query it did, regardless of size. When memcached is installed and you loaded all relationships for certain users, e.g. the default 'buddy' on your site, this could result in blowing out memory on a single cache_set(). I added a $cache_throttle PHP variable to control the maximum number of relationships it will try to cache. I set the PHP variable by doing a variable_get('user_relationships_cache_throttle', 5000) in anticipation of someday making the throttle an admin-configurable setting. However, nothing currently sets that drupal variable, so for now it's effectively hardcoded to cache a maximum of 5,000 relationships.

Comments

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.