Skip to content

Commit

Permalink
fix: return error on ctx done
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Staykov committed Oct 11, 2024
1 parent eb97b3f commit 23dba85
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions zk/datastream/client/stream_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func (c *StreamClient) GetL2BlockByNumber(blockNum uint64) (fullBLock *types.Ful
for {
select {
case <-c.ctx.Done():
log.Warn("[Datastream client] Context done - stopping")
return nil, errorCode, nil
return nil, errorCode, fmt.Errorf("[Datastream client] Context done - stopping")

default:
}
if count > 5 {
Expand Down Expand Up @@ -194,8 +194,7 @@ func (c *StreamClient) GetLatestL2Block() (l2Block *types.FullL2Block, err error
for {
select {
case <-c.ctx.Done():
log.Warn("[Datastream client] Context done - stopping")
return nil, nil
return nil, fmt.Errorf("[Datastream client] Context done - stopping")
default:
}
if count > 5 {
Expand Down Expand Up @@ -410,8 +409,7 @@ func (c *StreamClient) ReadAllEntriesToChannel() (err error) {
for {
select {
case <-c.ctx.Done():
log.Warn("[Datastream client] Context done - stopping")
return nil
return fmt.Errorf("[Datastream client] Context done - stopping")
default:
}
if count > 5 {
Expand Down

0 comments on commit 23dba85

Please sign in to comment.