After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658411 - Only emit notifications for linkable properties if they've actually changed
Only emit notifications for linkable properties if they've actually changed
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: libfolks
git master
Other All
: Normal normal
: folks-0.6.2
Assigned To: folks-maint
folks-maint
Depends on:
Blocks: 656689
 
 
Reported: 2011-09-06 22:02 UTC by Philip Withnall
Modified: 2011-09-07 22:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
e-d-s: don't emit notifications when linkable properties didn't actually change (11.45 KB, patch)
2011-09-07 17:46 UTC, Raul Gutierrez Segales
none Details | Review
updated patch (20.76 KB, patch)
2011-09-07 20:55 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review

Description Philip Withnall 2011-09-06 22:02:47 UTC
Currently, at least in the EDS and Tracker backends, we're unconditionally emitting property change notifications for properties when their _update_[property name]() functions get called.

While this isn't technically wrong, it does mean that the IndividualAggregator ends up doing a lot of extra work re-linking personas when nothing's actually changed. This also results in spurious IndividualAggregator.individuals_changed_detailed signals, which break the tests when the patch in bug #656689 is applied.

At least for the linkable properties, we should ensure that we only emit change notifications when things have actually changed.

This fits in well with bug #657680, which suggests that we should never be calling Set.clear() on sets of values (such as sets of FieldDetails), since we could be breaking the iterator on that set which is currently being used in client code.

I guess our template for _update_*() functions should change to something like:

var new_bag_o_values = new HashSet<Foo> ();
var changed = (get_new_value_from_backend ().size != this._bag_o_values.size); // If the sets have different sizes, we don't need to perform a detailed check, since we know the property's changed

foreach (var v in get_new_value_from_backend ())
  {
    if (changed == false)
      {
        var old_v = this._bag_o_values.get (v);
        if (old_v == null || !v.equal (old_v))
          {
            changed = true;
          }
      }

    new_bag_o_values.add (v);
  }

if (changed == true)
  {
    this._bag_o_values = new_bag_o_values;
    this._bag_o_values_ro = new_bag_o_values.read_only_view;
    this.notify_property ("bag-o-values");
  }
Comment 1 Raul Gutierrez Segales 2011-09-07 17:33:42 UTC
We need this for 0.6.2, because it blocks #656689.
Comment 2 Raul Gutierrez Segales 2011-09-07 17:46:06 UTC
Created attachment 195917 [details] [review]
e-d-s: don't emit notifications when linkable properties didn't actually change

I'll follow up with a patch to do the same for Tracker.
Comment 3 Raul Gutierrez Segales 2011-09-07 20:55:35 UTC
Created attachment 195933 [details] [review]
updated patch

updated patch with tracker tests updated, all tests pass for me!
Comment 4 Travis Reitter 2011-09-07 21:34:56 UTC
Review of attachment 195933 [details] [review]:

Looks good!
Comment 5 Raul Gutierrez Segales 2011-09-07 22:19:28 UTC
Merged:

commit 6ba0b7484b83b019480ab8c6e1537cff9c2495a9
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 23:04:07 2011 +0100

    tracker: update link personas test

commit 53515f94ca402219d5de59f3393e749880974e32
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 23:03:32 2011 +0100

    tracker: update IM addresses updates test

commit dec3da1c8db3fa39c39cd46cb328f461d8b95de4
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 23:02:28 2011 +0100

    tracker: update add persona tes

commit 097f622cb21d2f6e1f8f706baab50141eb0fdfe6
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 23:01:59 2011 +0100

    tracker: update set-im-addresses test
    
    Because IM addresses are linkable property, a new Individual
    is created when they are modified.

commit d9d9a7ab754a5174fcde3ca94f9248f253d8bfed
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 23:01:19 2011 +0100

    e-d-s: update set-im-addresses test
    
    Because IM addresses are linkable property, a new Individual
    is created when they are modified.

commit a2837fa5a392daa8d54d159a974cb317baf59feb
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 23:00:48 2011 +0100

    e-d-s: only emit notifications if linkable properties changed
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=658411

commit 525679227287ca21270c996762864be1f4962323
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Sep 7 22:59:41 2011 +0100

    e-d-s: move Set comparison method into it's own class
    
    This refactoring is so we can reuse the method with other
    types.