Merge pull request #3122 from chengzhichao-xydt/codex/evolution-store-close
fix(evolution): capture Close() error on write file in appendJSONLRecords
This commit is contained in:
commit
647543bd26
1 changed files with 5 additions and 1 deletions
|
|
@ -88,7 +88,11 @@ func (s *Store) appendJSONLRecords(ctx context.Context, path string, records []L
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() {
|
||||
if closeErr := f.Close(); closeErr != nil && err == nil {
|
||||
err = closeErr
|
||||
}
|
||||
}()
|
||||
|
||||
enc := json.NewEncoder(f)
|
||||
for _, record := range records {
|
||||
|
|
|
|||
Loading…
Reference in a new issue