From eaec0a94eae2a8514cdb5d6d23a75c6000d3aab2 Mon Sep 17 00:00:00 2001 From: Siratee K Date: Fri, 5 Apr 2024 23:38:55 +0700 Subject: [PATCH] fix: Update --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 2930d10..1f7f4ff 100644 --- a/main.go +++ b/main.go @@ -11,8 +11,8 @@ import ( ) type TaskAttribute struct { - SleepTime *time.Duration `json:"sleepTime,omitempty"` - MemoryAllocationSize *int `json:"memoryAllocationSize,omitempty"` + SleepTime *int `json:"sleepTime,omitempty"` + MemoryAllocationSize *int `json:"memoryAllocationSize,omitempty"` } func main() { @@ -24,9 +24,9 @@ func main() { return err } - if unmarshalledData.SleepTime == nil { - sleepTime := 15 * time.Second - unmarshalledData.SleepTime = &sleepTime + sleepTime := 15 * time.Second + if unmarshalledData.SleepTime != nil { + sleepTime = time.Duration(*unmarshalledData.SleepTime) * time.Second } if unmarshalledData.MemoryAllocationSize == nil { @@ -39,7 +39,7 @@ func main() { fakeAllocation[i] = 0x99 } - time.Sleep(*unmarshalledData.SleepTime) + time.Sleep(sleepTime) fmt.Println(unmarshalledData) ctx.Success()