Commit 0b4077e5 authored by Kien Trinh's avatar Kien Trinh Committed by GitHub

perf: remove defer inside loop (#10497)

parent 9ef59814
...@@ -134,11 +134,12 @@ func fetchBatchesPerBlock(ctx context.Context, client *ethclient.Client, number ...@@ -134,11 +134,12 @@ func fetchBatchesPerBlock(ctx context.Context, client *ethclient.Client, number
if err != nil { if err != nil {
return 0, 0, err return 0, 0, err
} }
defer file.Close()
enc := json.NewEncoder(file) enc := json.NewEncoder(file)
if err := enc.Encode(txm); err != nil { if err := enc.Encode(txm); err != nil {
file.Close()
return 0, 0, err return 0, 0, err
} }
file.Close()
} }
} }
return validBatchCount, invalidBatchCount, nil return validBatchCount, invalidBatchCount, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment