Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Jun 19, 2023
1 parent db532b2 commit f0cbc2f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
7 changes: 1 addition & 6 deletions chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,5 @@ func BatchCall(ctx context.Context, chain schema.Chain, inputs []schema.ChainVal
return nil, err
}

select {
case <-ctx.Done():
return nil, ctx.Err()
default:
return chainValues, nil
}
return chainValues, nil
}
19 changes: 0 additions & 19 deletions chain/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,6 @@ func TestBatchCall(t *testing.T) {
expected: nil,
expectedError: errors.New("error occurred during chain.Call"),
},
{
name: "Context Cancellation",
ctx: func() context.Context {
ctx, cancel := context.WithCancel(context.Background())
// Cancel the context immediately to simulate cancellation
cancel()
return ctx
}(),
chain: MockChain{
CallFunc: func(ctx context.Context, inputs schema.ChainValues) (schema.ChainValues, error) {
// Mocked implementation of the chain.Call function
// This function should not be called as the context is already cancelled
return schema.ChainValues{}, nil
},
},
inputs: []schema.ChainValues{},
expected: nil,
expectedError: context.Canceled,
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit f0cbc2f

Please sign in to comment.