Skip to content

Commit

Permalink
fix: report write panic
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelncui committed Dec 13, 2022
1 parent 8ccecd8 commit b9355ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion executor/job_archive_exe.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ func (a *jobArchiveExecutor) makeTape(ctx context.Context, device, barcode, name
a.logger.WithContext(ctx).WithError(err).Warnf("open report file fail, barcode= '%s'", barcode)
} else {
defer reportFile.Close()
reportFile.Write([]byte(report.ToJSONString(false)))
tools.Wrap(ctx, func() {
reportFile.Write([]byte(report.ToJSONString(false)))
})
}

filteredJobs := make([]*acp.Job, 0, len(report.Jobs))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/abc950309/tapewriter
go 1.18

require (
github.com/abc950309/acp v0.0.0-20221213054500-913956ff10a1
github.com/abc950309/acp v0.0.0-20221213100222-6351045e0f95
github.com/aws/aws-sdk-go v1.44.118
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set/v2 v2.1.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ github.com/abc950309/acp v0.0.0-20221213025816-edd8196e43e6 h1:lgO5pSBYSHqkCYP3/
github.com/abc950309/acp v0.0.0-20221213025816-edd8196e43e6/go.mod h1:7gK/wICIhVBZ6B2AZm+0uN06wDhKLSsq4TME/fwJUJI=
github.com/abc950309/acp v0.0.0-20221213054500-913956ff10a1 h1:UgiD4G3c3WROUHp+elpLVvKuW0+9xErtgkilnDb+XdU=
github.com/abc950309/acp v0.0.0-20221213054500-913956ff10a1/go.mod h1:7gK/wICIhVBZ6B2AZm+0uN06wDhKLSsq4TME/fwJUJI=
github.com/abc950309/acp v0.0.0-20221213100222-6351045e0f95 h1:psZpPKseSGyZlLqJkfaklXlH9KVLzFM/VCQsWoJAm1E=
github.com/abc950309/acp v0.0.0-20221213100222-6351045e0f95/go.mod h1:7gK/wICIhVBZ6B2AZm+0uN06wDhKLSsq4TME/fwJUJI=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down

0 comments on commit b9355ad

Please sign in to comment.