From b9355ad892b7dcc61bb1dbd028c0e39bfb6f6eed Mon Sep 17 00:00:00 2001 From: Samuel N Cui Date: Tue, 13 Dec 2022 18:09:27 +0800 Subject: [PATCH] fix: report write panic --- executor/job_archive_exe.go | 4 +++- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/executor/job_archive_exe.go b/executor/job_archive_exe.go index 029f200..bd42ded 100644 --- a/executor/job_archive_exe.go +++ b/executor/job_archive_exe.go @@ -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)) diff --git a/go.mod b/go.mod index cbfb7df..19f9c13 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index b68f635..523abbd 100644 --- a/go.sum +++ b/go.sum @@ -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=