Loading .meepctl-repocfg.yaml +6 −1 Original line number Diff line number Diff line Loading @@ -444,7 +444,7 @@ repo: # enable meepctl deploy/delete deploy: true # supports code coverage measurement when built in codecov mode codecov: false codecov: true # supports linting lint: true # location of API specifications Loading Loading @@ -1023,6 +1023,11 @@ repo: src: go-packages/meep-sessions # supports linting lint: true meep-subscriptions: # location of source code src: go-packages/meep-subscriptions # supports linting lint: true meep-users: # location of source code src: go-packages/meep-users Loading go-packages/meep-subscriptions/subscription-mgr.go +10 −6 Original line number Diff line number Diff line Loading @@ -272,12 +272,12 @@ func (sm *SubscriptionMgr) ReadyToSend(sub *Subscription) bool { if sub == nil { return false } sm.mutex.Lock() defer sm.mutex.Unlock() // Subscription state if sub.State != StateReady { return false } // Websocket state if sub.Ws != nil && sub.Ws.State != WsStateReady { if !sub.isReady() { return false } // Periodic interval Loading Loading @@ -453,13 +453,17 @@ func (sm *SubscriptionMgr) runTicker() { if sub.PeriodicCounter > 0 { sub.PeriodicCounter-- } if sub.PeriodicCounter == 0 && sub.State == StateReady { // If periodic interval is up, trigger notification if subscription is ready if sub.PeriodicCounter == 0 && sub.isReady() { // Set counter to -1; it will be reset when notification is sent sub.PeriodicCounter = periodicCounterPending // Invoke periodic callback log.Debug("Invoking periodic callback for sub: ", sub.Cfg.Id) go sm.cfg.PeriodicSubCb(sub) } else if sub.PeriodicCounter == periodicCounterPending && sub.isReady() { // Handle error cases where notification was not sent sub.PeriodicCounter = sub.Cfg.PeriodicInterval } } } Loading go-packages/meep-subscriptions/subscription.go +12 −0 Original line number Diff line number Diff line Loading @@ -275,3 +275,15 @@ func (sub *Subscription) sendWsRequest(request *http.Request) (*http.Response, e return resp, nil } func (sub *Subscription) isReady() bool { // Subscription state if sub.State != StateReady { return false } // Websocket state if sub.Ws != nil && sub.Ws.State != WsStateReady { return false } return true } go-packages/meep-subscriptions/websocket.go +2 −2 Original line number Diff line number Diff line Loading @@ -130,8 +130,8 @@ func (ws *Websocket) startMsgHandler() { if err != nil { log.Error(err.Error()) // Reset websocket state ws.State = WsStateInit // Close websocket ws.close() return } Loading Loading
.meepctl-repocfg.yaml +6 −1 Original line number Diff line number Diff line Loading @@ -444,7 +444,7 @@ repo: # enable meepctl deploy/delete deploy: true # supports code coverage measurement when built in codecov mode codecov: false codecov: true # supports linting lint: true # location of API specifications Loading Loading @@ -1023,6 +1023,11 @@ repo: src: go-packages/meep-sessions # supports linting lint: true meep-subscriptions: # location of source code src: go-packages/meep-subscriptions # supports linting lint: true meep-users: # location of source code src: go-packages/meep-users Loading
go-packages/meep-subscriptions/subscription-mgr.go +10 −6 Original line number Diff line number Diff line Loading @@ -272,12 +272,12 @@ func (sm *SubscriptionMgr) ReadyToSend(sub *Subscription) bool { if sub == nil { return false } sm.mutex.Lock() defer sm.mutex.Unlock() // Subscription state if sub.State != StateReady { return false } // Websocket state if sub.Ws != nil && sub.Ws.State != WsStateReady { if !sub.isReady() { return false } // Periodic interval Loading Loading @@ -453,13 +453,17 @@ func (sm *SubscriptionMgr) runTicker() { if sub.PeriodicCounter > 0 { sub.PeriodicCounter-- } if sub.PeriodicCounter == 0 && sub.State == StateReady { // If periodic interval is up, trigger notification if subscription is ready if sub.PeriodicCounter == 0 && sub.isReady() { // Set counter to -1; it will be reset when notification is sent sub.PeriodicCounter = periodicCounterPending // Invoke periodic callback log.Debug("Invoking periodic callback for sub: ", sub.Cfg.Id) go sm.cfg.PeriodicSubCb(sub) } else if sub.PeriodicCounter == periodicCounterPending && sub.isReady() { // Handle error cases where notification was not sent sub.PeriodicCounter = sub.Cfg.PeriodicInterval } } } Loading
go-packages/meep-subscriptions/subscription.go +12 −0 Original line number Diff line number Diff line Loading @@ -275,3 +275,15 @@ func (sub *Subscription) sendWsRequest(request *http.Request) (*http.Response, e return resp, nil } func (sub *Subscription) isReady() bool { // Subscription state if sub.State != StateReady { return false } // Websocket state if sub.Ws != nil && sub.Ws.State != WsStateReady { return false } return true }
go-packages/meep-subscriptions/websocket.go +2 −2 Original line number Diff line number Diff line Loading @@ -130,8 +130,8 @@ func (ws *Websocket) startMsgHandler() { if err != nil { log.Error(err.Error()) // Reset websocket state ws.State = WsStateInit // Close websocket ws.close() return } Loading