Skip to content

Commit 8b4868d

Browse files
refactor: optimize user reader and writer initialization in QueueSubscriptions
- Simplified the initialization of user reader and writer instances in the QueueSubscriptions function by reusing the created userReaderWriter variable, enhancing code clarity and reducing redundancy. Jira Ticket: https://linuxfoundation.atlassian.net/browse/LFXV2-492 Reviewed with [GitHub Copilot](https://github.com/features/copilot) Signed-off-by: Mauricio Zanetti Salomao <mauriciozanetti86@gmail.com>
1 parent 4159789 commit 8b4868d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/server/service/providers.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,15 @@ func QueueSubscriptions(ctx context.Context) error {
137137
// Initialize NATS client first
138138
natsInit(ctx)
139139

140+
userReaderWriter := newUserReaderWriter(ctx)
141+
140142
messageHandlerService := &MessageHandlerService{
141143
messageHandler: service.NewMessageHandlerOrchestrator(
142144
service.WithUserWriterForMessageHandler(
143-
newUserReaderWriter(ctx),
145+
userReaderWriter,
144146
),
145147
service.WithUserReaderForMessageHandler(
146-
newUserReaderWriter(ctx),
148+
userReaderWriter,
147149
),
148150
),
149151
}

0 commit comments

Comments
 (0)