bigbluebutton-Github/bbb-graphql-middleware/internal/hascli/retransmiter/retransmiter.go
Gustavo Trott 095085310d
refactor: Graphql middleware enhancements (#19336)
* Convert all go chan to SafeChannel

* Remove unnecessary comments

* Refactor graphql message names

* Fix renamed function
2023-12-14 14:01:47 -03:00

20 lines
775 B
Go

package retransmiter
import (
"github.com/iMDT/bbb-graphql-middleware/internal/common"
log "github.com/sirupsen/logrus"
)
func RetransmitSubscriptionStartMessages(hc *common.HasuraConnection, fromBrowserToHasuraChannel *common.SafeChannel) {
log := log.WithField("_routine", "RetransmitSubscriptionStartMessages").WithField("browserConnectionId", hc.Browserconn.Id).WithField("hasuraConnectionId", hc.Id)
hc.Browserconn.ActiveSubscriptionsMutex.RLock()
for _, subscription := range hc.Browserconn.ActiveSubscriptions {
if subscription.LastSeenOnHasuraConnetion != hc.Id {
log.Tracef("retransmiting subscription start: %v", subscription.Message)
fromBrowserToHasuraChannel.Send(subscription.Message)
}
}
hc.Browserconn.ActiveSubscriptionsMutex.RUnlock()
}