Skip to content

Commit fb5322b

Browse files
small fixes
Signed-off-by: Said Altury <Said.Altury@ibm.com>
1 parent ce16584 commit fb5322b

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

integration/fabricx/simple/views/create.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ func (i *CreateView) Call(viewCtx view.Context) (interface{}, error) {
8787
return nil, err
8888
}
8989

90-
9190
// now we have a committer listener registered, we send the approved transaction to the orderer
9291
logger.Infof("Submit tx (txID=%v) to ordering service", tx.ID())
9392
if _, err = viewCtx.RunView(state.NewOrderingAndFinalityWithTimeoutView(tx, FinalityTimeout)); err != nil {

platform/fabricx/core/finality/listenermanager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"reflect"
1212
"sync"
1313

14-
"github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/assert"
1514
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1615
"github.com/hyperledger-labs/fabric-smart-client/platform/common/driver"
16+
"github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/assert"
1717
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric"
1818
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/driver/config"
1919
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services"
@@ -89,9 +89,9 @@ func newNotifi(ctx context.Context, cfg config.ConfigService) (*notificationList
8989
return nil, err
9090
}
9191
// CRITICAL FIX: Use context.Background() for the stream lifecycle.
92-
// This ensures the stream stays alive for the duration of the shared manager,
93-
// regardless of when the individual view's context (ctx) is cancelled.
94-
streamCtx := context.Background()
92+
// This ensures the stream stays alive for the duration of the shared manager,
93+
// regardless of when the individual view's context (ctx) is cancelled.
94+
streamCtx := context.Background()
9595

9696
notifyClient := protonotify.NewNotifierClient(cc)
9797
notifyStream, err := notifyClient.OpenNotificationStream(streamCtx)

platform/fabricx/core/finality/nlm_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func TestNotificationListenerManager(t *testing.T) {
142142

143143
// run Listen
144144
go func() {
145-
_ = nlm.Listen(ctx)
145+
_ = nlm.Listen()
146146
}()
147147

148148
require.EventuallyWithT(t, func(collect *assert.CollectT) {
@@ -185,7 +185,7 @@ func TestNotificationListenerManager(t *testing.T) {
185185
}
186186

187187
go func() {
188-
_ = nlm.Listen(ctx)
188+
_ = nlm.Listen()
189189
}()
190190

191191
require.EventuallyWithT(t, func(collect *assert.CollectT) {
@@ -212,7 +212,7 @@ func TestNotificationListenerManager(t *testing.T) {
212212

213213
// start the manager
214214
go func() {
215-
_ = nlm.Listen(ctx)
215+
_ = nlm.Listen()
216216
}()
217217

218218
// add a listener
@@ -243,7 +243,7 @@ func TestNotificationListenerManager(t *testing.T) {
243243

244244
// start the manager
245245
go func() {
246-
_ = nlm.Listen(ctx)
246+
_ = nlm.Listen()
247247
}()
248248

249249
// The single listener instance used for both calls
@@ -289,7 +289,7 @@ func TestNotificationListenerManager(t *testing.T) {
289289
}
290290

291291
go func() {
292-
_ = nlm.Listen(ctx)
292+
_ = nlm.Listen()
293293
}()
294294

295295
ml1 := &mockListener{txID: "1"}
@@ -369,7 +369,7 @@ func TestNotificationListenerManager(t *testing.T) {
369369
// start the manager
370370
errs := make(chan error, 1)
371371
go func() {
372-
errs <- nlm.Listen(cancelable_ctx)
372+
errs <- nlm.Listen()
373373
}()
374374

375375
// wait briefly to ensure all goroutines are up and blocking
@@ -391,13 +391,13 @@ func TestNotificationListenerManager(t *testing.T) {
391391

392392
t.Run("Stream Error Handling", func(t *testing.T) {
393393
t.Parallel()
394-
nlm, fakeStream, ctx := setupTest(t)
394+
nlm, fakeStream, _ := setupTest(t)
395395

396396
expectedErr := errors.New("stream broken")
397397
fakeStream.RecvReturns(nil, expectedErr)
398398

399399
// listen should return the error immediately
400-
err := nlm.Listen(ctx)
400+
err := nlm.Listen()
401401
require.ErrorIs(t, err, expectedErr)
402402
})
403403

0 commit comments

Comments
 (0)