Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: code gremlin? listNotificationinterests accepts same note more than once.  (Read 3511 times)
letapjar
Newbie
*
Posts: 5


View Profile Email
« on: February 20, 2011, 08:46:17 »

Just spent 2 hours chasing down a code gremlin.

I had a mediator that had a long list of notifications it needed to respond to.

Somehow a couple of notifications were entered twice in the list notification interests array.

This resulted in handle notification being called twice for the notes that were listed twice.

Is this by design?

Seems to me that there should be some check in the register mediator process that makes sure a mediator only listens to a note once since all notes are processed by the same handleNotification method.

Is there actually a use case for having the handleNotification method fired twice in the same mediator for the same note?

(oh btw this was the AS3 multi-core version).
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 20, 2011, 12:31:48 »

No use case for doubled note names exists.

But after weighing the extra code and aggregate cycles that would be spent ensuring that there are no duplicates in mediator notification lists when 99.999999% of the time their won't be, I'm inclined to simply point out that Garbage In/Garbage Out applies: If you register twice, you're going to be notified twice.

-=Cliff>
« Last Edit: February 20, 2011, 12:38:00 by puremvc » Logged
Pages: [1]
Print