Jeffrey,

Unless there are more cases of observers on stamps observing attributes on ContentItem, I think it'd be better to put the overhead of checking for stampedness in the individual observer, to avoid adding overhead to all notifications.

(Also, wouldn't checking stampedness in the dispatch mechanism prevent you from getting notified when an EventStamp'd item is unstamped, and removed from collections as a result?)

...Bryan

Jeffrey Harris wrote:
Hi Folks,

I have code in EventStamp (on the recurrence branch) that says:

    @schema.observer(ContentItem.collections)
    def onCollectionChange(self, op, name):
        ...

I just realized that this observer gets called every time an item is
added to (or removed from) a collection, not just when EventStamps are
added to collections, because it's watching an attribute that doesn't
live on EventStamp.

I think for my use cases, I'd be happy to have observers on stamps only
get called if the item in question has that stamp.  Do other folks have
use cases where they want observers to apply to all items, regardless of
stamp?  Would it be reasonable for those observers to always live on
ContentItem?

If so, it seems like we could save ourselves a bit of method calling by
checking stamps before calling observers.  I'm not sure that that'll buy
us all that much, method calls aren't all that expensive, but it would
be interesting to see if it buys us anything.  It also seems
conceptually cleaner to me.

Thoughts?

Sincerely,
Jeffrey
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to