Minimize Event Noise for Server Updates / Handle Blocking Flow for ContactRetry plugin
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
6d29ca322e
commit
407902b8ee
|
@ -180,7 +180,7 @@ func (cr *contactRetry) run() {
|
||||||
cr.bus.Subscribe(event.ProtocolEngineShutdown, cr.queue)
|
cr.bus.Subscribe(event.ProtocolEngineShutdown, cr.queue)
|
||||||
cr.bus.Subscribe(event.ProtocolEngineCreated, cr.queue)
|
cr.bus.Subscribe(event.ProtocolEngineCreated, cr.queue)
|
||||||
cr.bus.Subscribe(event.DeleteContact, cr.queue)
|
cr.bus.Subscribe(event.DeleteContact, cr.queue)
|
||||||
|
cr.bus.Subscribe(event.UpdateConversationAuthorization, cr.queue)
|
||||||
for {
|
for {
|
||||||
// Only attempt connection if both the ACN and the Protocol Engines are Online...
|
// Only attempt connection if both the ACN and the Protocol Engines are Online...
|
||||||
log.Debugf("restartFlow checking state")
|
log.Debugf("restartFlow checking state")
|
||||||
|
@ -234,6 +234,14 @@ func (cr *contactRetry) run() {
|
||||||
// same delete conversation flow)
|
// same delete conversation flow)
|
||||||
peer := e.Data[event.RemotePeer]
|
peer := e.Data[event.RemotePeer]
|
||||||
cr.authorizedPeers.Delete(peer)
|
cr.authorizedPeers.Delete(peer)
|
||||||
|
case event.UpdateConversationAuthorization:
|
||||||
|
// if we update the conversation authorization then we need to check if
|
||||||
|
// we need to remove blocked conversations from the regular flow.
|
||||||
|
peer := e.Data[event.RemotePeer]
|
||||||
|
blocked := e.Data[event.Blocked]
|
||||||
|
if blocked == "true" {
|
||||||
|
cr.authorizedPeers.Delete(peer)
|
||||||
|
}
|
||||||
case event.PeerStateChange:
|
case event.PeerStateChange:
|
||||||
state := connections.ConnectionStateToType()[e.Data[event.ConnectionState]]
|
state := connections.ConnectionStateToType()[e.Data[event.ConnectionState]]
|
||||||
peer := e.Data[event.RemotePeer]
|
peer := e.Data[event.RemotePeer]
|
||||||
|
|
|
@ -42,9 +42,8 @@ func (f *Functionality) OnEvent(ev event.Event, profile peer.CwtchPeer) {
|
||||||
if profile.IsFeatureEnabled(constants.GroupsExperiment) {
|
if profile.IsFeatureEnabled(constants.GroupsExperiment) {
|
||||||
switch ev.EventType {
|
switch ev.EventType {
|
||||||
// keep the UI in sync with the current backend server updates...
|
// keep the UI in sync with the current backend server updates...
|
||||||
// TODO: do we need a secondary heartbeat for less common updates?
|
// queue join server gets triggered on load and on new servers so it's a nice
|
||||||
case event.Heartbeat:
|
// low-noise event to hook into...
|
||||||
f.PublishServerUpdate(profile)
|
|
||||||
case event.QueueJoinServer:
|
case event.QueueJoinServer:
|
||||||
f.PublishServerUpdate(profile)
|
f.PublishServerUpdate(profile)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue