Skip to content

Commit

Permalink
singleton bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Mor <[email protected]>

Signed-off-by: Amit Mor <[email protected]>
  • Loading branch information
amimimor committed Oct 26, 2023
1 parent 163489b commit 41bef96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pubsub/aws/snssqs/subscription_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type SubscriptionManagement interface {
GetSubscriptionTopicHandler(string) (*SubscriptionTopicHandler, bool)
}

func NewSubscriptionMgmt(log logger.Logger) *SubscriptionManager {
func NewSubscriptionMgmt(log logger.Logger) SubscriptionManagement {
return &SubscriptionManager{
logger: log,
consumeCancelFunc: func() {}, // noop until we (re)start sqs consumption
Expand All @@ -73,7 +73,7 @@ func (sm *SubscriptionManager) Init(queueInfo *sqsQueueInfo, dlqInfo *sqsQueueIn
initOnce.Do(func() {
sm.logger.Debug("Initializing subscription manager")
queueConsumerCbk := createQueueConsumerCbk(queueInfo, dlqInfo, cbk)
go subscriptionMgmtInst.queueConsumerController(queueConsumerCbk)
go sm.queueConsumerController(queueConsumerCbk)
sm.logger.Debug("Subscription manager initialized")
})
}
Expand All @@ -86,6 +86,7 @@ func (sm *SubscriptionManager) Init(queueInfo *sqsQueueInfo, dlqInfo *sqsQueueIn
// it is also responsible for managing the lifecycle of the subscription handlers.
func (sm *SubscriptionManager) queueConsumerController(queueConsumerCbk func(context.Context)) {
ctx := context.Background()
sm.logger.Debugf("%+v", sm)

for {
select {
Expand Down

0 comments on commit 41bef96

Please sign in to comment.