Skip to content

Commit d7e938a

Browse files
committed
fix: Fix image pull log printing abnormality issue
1 parent d957990 commit d7e938a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

agent/utils/docker/docker.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"os"
99
"strings"
10+
"sync"
1011
"time"
1112

1213
"github.com/1Panel-dev/1Panel/agent/app/model"
@@ -165,7 +166,11 @@ func CreateDefaultDockerNetwork() error {
165166
return nil
166167
}
167168

169+
var mu sync.Mutex
170+
168171
func setLog(id, newLastLine string, task *task.Task) error {
172+
mu.Lock()
173+
defer mu.Unlock()
169174
data, err := os.ReadFile(task.Task.LogFile)
170175
if err != nil {
171176
return fmt.Errorf("failed to read file: %v", err)

0 commit comments

Comments
 (0)