RosterLoadedEvent (#79)
Unknown opened 4 years ago

Right now, we have a few events in the RosterModule for item change (Added, Updated, Removed). However, at the startup time, in GUI it is inefficient to deal individual roster items and updated GUI for each element.

It would be very useful to have a single event handler called once, the entire roster is loaded. Then, in the GUI I can load all roster items and display up to date list.

Unknown commented 4 years ago

Implemented.

Unknown commented 4 years ago

Ok, thank you for quick response.

I haven't tried the new event yet but I noticed that now, there is no event fired for individual roster items when they are being added. I think this old call is still useful and worth having it. So I do not want to remove the ItemAdded event. It's good to have both event called.

Unknown commented 4 years ago

I checked Halcyon logs and it looks like actually, the event for individual roster items added is called before RosterLoadedEvent and this is what I wanted and what expected. For some reasons, however, the event is not calling my handler. I will be investigating it further tomorrow.

However, the RosterLoadedEvent is called 2 times at the app startup time and looking into Halcyon logs, it seems that the library requests roster twice, hence receives roster twice and then calls RosterLoadedEvent 2 times. It seems like the double roster requesting is redundant here and should be avoided.

The logs shows 2 distinct roster get requests with different stanza IDs and then the app receives 2 roster responses.

here is log excerpt:

[EDT] 0:0:9,247 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event HalcyonStateChangeEvent(oldState=Connecting, newState=Connected) with 3 handlers
[EDT] 0:0:9,250 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <iq to="tigase.org" id="NLw6qLx16LZbaoJXBTBvnmpH" type="get"><query xmlns="http://jabber.org/protocol/disco#info" node="https://tigase.net/tigase-xmpp-server#CEd/IMWsFdH+nTfMKQuYdogsumU="/></iq>
[EDT] 0:0:9,250 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=IQ[type=get id=NLw6qLx16LZbaoJXBTBvnmpH to=tigase.org ], request=Request[to=tigase.org, id=NLw6qLx16LZbaoJXBTBvnmpH: <iq to="tigase.org" id="NLw6qLx16LZbaoJXBTBvnmpH" type="get"><query xmlns="http://jabber.org/protocol/disco#info" node="https://tigase.net/tigase-xmpp-server#CEd/IMWsFdH+nTfMKQuYdogsumU="/></iq>]) with 2 handlers
user@domain.org is now Connected
Doing nothing
[Timer-1] 0:0:9,281 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event TickEvent(counter=1) with 5 handlers
[Timer-1] 0:0:9,281 - Wed Oct 07 16:45:32 PDT 2020 [FINE] tigase.halcyon.core.connector.WebSocketConnector: Whitespace ping
[EDT] 0:0:9,283 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <presence id="fUsyDtr7qDTYMkfC1F9QeXJ3"><c xmlns="http://jabber.org/protocol/caps" node="http://tigase.org/TigaseHalcyon" ver="LsHf0qzy39OO71UEo2UM53iYKJk=" hash="sha-1"/></presence>
[EDT] 0:0:9,284 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=PRESENCE[id=fUsyDtr7qDTYMkfC1F9QeXJ3 ], request=null) with 2 handlers


[EDT] 0:0:9,294 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <iq id="xhIdoXGHGqYOG84hJf6fxz8m" type="get"><query xmlns="jabber:iq:roster"><annotate xmlns="urn:xmpp:mix:roster:0"/></query></iq>
[EDT] 0:0:9,294 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=IQ[type=get id=xhIdoXGHGqYOG84hJf6fxz8m ], request=Request[to=null, id=xhIdoXGHGqYOG84hJf6fxz8m: <iq id="xhIdoXGHGqYOG84hJf6fxz8m" type="get"><query xmlns="jabber:iq:roster"><annotate xmlns="urn:xmpp:mix:roster:0"/></query></iq>]) with 2 handlers
[EDT] 0:0:9,294 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <iq to="tigase.org" id="F86U0Wr1OxjjGsnOJcYVEjqI" type="get"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
[EDT] 0:0:9,294 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=IQ[type=get id=F86U0Wr1OxjjGsnOJcYVEjqI to=tigase.org ], request=Request[to=tigase.org, id=F86U0Wr1OxjjGsnOJcYVEjqI: <iq to="tigase.org" id="F86U0Wr1OxjjGsnOJcYVEjqI" type="get"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>]) with 2 handlers
[EDT] 0:0:9,295 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <iq to="user@domain.org" id="YtMjVwbFr3sjXLQxmgZPYx9X" type="get"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
[EDT] 0:0:9,295 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=IQ[type=get id=YtMjVwbFr3sjXLQxmgZPYx9X to=user@domain.org ], request=Request[to=user@domain.org, id=YtMjVwbFr3sjXLQxmgZPYx9X: <iq to="user@domain.org" id="YtMjVwbFr3sjXLQxmgZPYx9X" type="get"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>]) with 2 handlers
[EDT] 0:0:9,295 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event tigase.halcyon.core.xmpp.SessionController$SessionControllerEvents$Successful@525f74a7 with 2 handlers
[EDT] 0:0:9,295 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <presence id="qElOc2jkeLpTCxpPpkkKsFG2"><c xmlns="http://jabber.org/protocol/caps" node="http://tigase.org/TigaseHalcyon" ver="LsHf0qzy39OO71UEo2UM53iYKJk=" hash="sha-1"/></presence>
[EDT] 0:0:9,295 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=PRESENCE[id=qElOc2jkeLpTCxpPpkkKsFG2 ], request=null) with 2 handlers


[EDT] 0:0:9,295 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.connector.WebSocketConnector: Sending: <iq id="86P7x2VvusPI4RfVQZukhxVS" type="get"><query xmlns="jabber:iq:roster"><annotate xmlns="urn:xmpp:mix:roster:0"/></query></iq>
[EDT] 0:0:9,296 - Wed Oct 07 16:45:32 PDT 2020 [FINEST] tigase.halcyon.core.eventbus.EventBus: Firing event SentXMLElementEvent(element=IQ[type=get id=86P7x2VvusPI4RfVQZukhxVS ], request=Request[to=null, id=86P7x2VvusPI4RfVQZukhxVS: <iq id="86P7x2VvusPI4RfVQZukhxVS" type="get"><query xmlns="jabber:iq:roster"><annotate xmlns="urn:xmpp:mix:roster:0"/></query></iq>]) with 2 handlers
Unknown commented 4 years ago

I fixed this error (and one more).

Unknown commented 4 years ago

Thank you, works as expected now.

issue 1 of 1
Issue Votes (0)
Watchers (0)
Reference
tigase/_libraries/halcyon#79
Please wait...
Page is in error, reload to recover