Skip to content

Commit

Permalink
[TT-609] Fix Bad Context Cancel (#10826)
Browse files Browse the repository at this point in the history
* Fix Bad Context Cancel

* Update

* Move cancel to the right spot
  • Loading branch information
kalverra authored Sep 28, 2023
1 parent 24dce59 commit f935479
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration-tests/testsetups/ocr.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,14 +555,13 @@ func (o *OCRSoakTest) setFilterQuery() {
func (o *OCRSoakTest) observeOCREvents() error {
eventLogs := make(chan types.Log)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
eventSub, err := o.chainClient.SubscribeFilterLogs(ctx, o.filterQuery, eventLogs)
cancel()
if err != nil {
return err
}

go func() {
defer cancel()
for {
select {
case event := <-eventLogs:
Expand All @@ -589,6 +588,7 @@ func (o *OCRSoakTest) observeOCREvents() error {
Msg("Error while subscribed to OCR Logs. Resubscribing")
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
eventSub, err = o.chainClient.SubscribeFilterLogs(ctx, o.filterQuery, eventLogs)
cancel()
}
}
}
Expand Down

0 comments on commit f935479

Please sign in to comment.