Skip to content

Commit

Permalink
remove consumerSessionManager from consumer ws sub
Browse files Browse the repository at this point in the history
  • Loading branch information
leon mandel authored and leon mandel committed Sep 17, 2024
1 parent 14937fa commit f265d89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions protocol/chainlib/consumer_ws_subscription_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type ConsumerWSSubscriptionManager struct {
connectedDapps map[string]map[string]*common.SafeChannelSender[*pairingtypes.RelayReply] // first key is dapp key, second key is hashed params
activeSubscriptions map[string]*activeSubscriptionHolder // key is params hash
relaySender RelaySender
consumerSessionManager *lavasession.ConsumerSessionManager
chainParser ChainParser
refererData *RefererData
connectionType string
Expand All @@ -69,7 +68,6 @@ type ConsumerWSSubscriptionManager struct {
}

func NewConsumerWSSubscriptionManager(
consumerSessionManager *lavasession.ConsumerSessionManager,
relaySender RelaySender,
refererData *RefererData,
connectionType string,
Expand All @@ -81,7 +79,6 @@ func NewConsumerWSSubscriptionManager(
connectedDapps: make(map[string]map[string]*common.SafeChannelSender[*pairingtypes.RelayReply]),
activeSubscriptions: make(map[string]*activeSubscriptionHolder),
currentlyPendingSubscriptions: make(map[string]*pendingSubscriptionsBroadcastManager),
consumerSessionManager: consumerSessionManager,
chainParser: chainParser,
refererData: refererData,
relaySender: relaySender,
Expand Down
11 changes: 3 additions & 8 deletions protocol/chainlib/consumer_ws_subscription_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ func TestConsumerWSSubscriptionManagerParallelSubscriptionsOnSameDappIdIp(t *tes
Return(relayResult1, nil).
Times(1) // Should call SendParsedRelay, because it is the first time we subscribe

consumerSessionManager := CreateConsumerSessionManager(play.specId, play.apiInterface, ts.Consumer.Addr.String())

// Create a new ConsumerWSSubscriptionManager
manager := NewConsumerWSSubscriptionManager(consumerSessionManager, relaySender, nil, play.connectionType, chainParser, lavasession.NewActiveSubscriptionProvidersStorage(), rpcconsumerLogs)
manager := NewConsumerWSSubscriptionManager(relaySender, nil, play.connectionType, chainParser, lavasession.NewActiveSubscriptionProvidersStorage(), rpcconsumerLogs)
uniqueIdentifiers := make([]string, numberOfParallelSubscriptions)
wg := sync.WaitGroup{}
wg.Add(numberOfParallelSubscriptions)
Expand Down Expand Up @@ -293,11 +291,10 @@ func TestConsumerWSSubscriptionManagerParallelSubscriptions(t *testing.T) {
Return(relayResult1, nil).
Times(1) // Should call SendParsedRelay, because it is the first time we subscribe

consumerSessionManager := CreateConsumerSessionManager(play.specId, play.apiInterface, ts.Consumer.Addr.String())
rpcconsumerLogs, _ := metrics.NewRPCConsumerLogs(nil, nil)
metricsData := metrics.NewRelayAnalytics(projectHashTest, chainIdTest, apiTypeTest)
// Create a new ConsumerWSSubscriptionManager
manager := NewConsumerWSSubscriptionManager(consumerSessionManager, relaySender, nil, play.connectionType, chainParser, lavasession.NewActiveSubscriptionProvidersStorage(), rpcconsumerLogs)
manager := NewConsumerWSSubscriptionManager(relaySender, nil, play.connectionType, chainParser, lavasession.NewActiveSubscriptionProvidersStorage(), rpcconsumerLogs)

wg := sync.WaitGroup{}
wg.Add(10)
Expand Down Expand Up @@ -541,10 +538,8 @@ func TestConsumerWSSubscriptionManager(t *testing.T) {
Return(relayResult1, nil).
Times(1) // Should call SendParsedRelay, because it is the first time we subscribe

consumerSessionManager := CreateConsumerSessionManager(play.specId, play.apiInterface, ts.Consumer.Addr.String())

// Create a new ConsumerWSSubscriptionManager
manager := NewConsumerWSSubscriptionManager(consumerSessionManager, relaySender, nil, play.connectionType, chainParser, lavasession.NewActiveSubscriptionProvidersStorage(), rpcconsumerLogs)
manager := NewConsumerWSSubscriptionManager(relaySender, nil, play.connectionType, chainParser, lavasession.NewActiveSubscriptionProvidersStorage(), rpcconsumerLogs)

// Start a new subscription for the first time, called SendParsedRelay once
ctx = utils.WithUniqueIdentifier(ctx, utils.GenerateUniqueIdentifier())
Expand Down

0 comments on commit f265d89

Please sign in to comment.