Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion db/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ func (c *mongoCollection) Watch(ctx context.Context, filter interface{}, cb Watc
// keeping the handles and stack clean
// Note: this may not be required, if loop doesn't require it
// but still it is safe to keep ensuring appropriate cleanup
defer stream.Close(context.Background())
defer func() {
// ignore the error returned by stream close as of now
_ = stream.Close(context.Background())
}()
defer func() {
if !errors.Is(ctx.Err(), context.Canceled) {
// panic if the return from this function is not
Expand Down
4 changes: 2 additions & 2 deletions db/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ func Test_CollectionWatch(t *testing.T) {
mongoTestAddUpOps = 0
mongoTestDeleteOps = 0
myMongoTestDeleteOps = 0
col.Watch(watchCtx, nil, myKeyWatcher)
_ = col.Watch(watchCtx, nil, myKeyWatcher)
matchDeleteStage := mongo.Pipeline{bson.D{{Key: "$match", Value: bson.D{{Key: "operationType", Value: "delete"}}}}}
col.Watch(watchCtx, matchDeleteStage, myDeleteWatcher)
_ = col.Watch(watchCtx, matchDeleteStage, myDeleteWatcher)

key := &MyKey{
Name: "test-key",
Expand Down
4 changes: 1 addition & 3 deletions lock/owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,5 @@ func InitializeLockOwner(ctx context.Context, store db.Store, name string) error
}

// allocate owner entry context
ownerTable.allocateOwner(name)

return nil
return ownerTable.allocateOwner(name)
}