Skip to content

Commit 40491e6

Browse files
csweichelroboquat
authored andcommitted
[ws-daemon] Remove stray "cannot write limit" errors
1 parent 9dfc038 commit 40491e6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

components/ws-daemon/pkg/cgroup/plugin_iolimit_v1.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (c *IOLimiterV1) produceLimits(kind string, value int64, useCache bool) []s
179179
return val.([]string)
180180
}
181181

182-
lines := make([]string, len(c.devices))
182+
lines := make([]string, 0, len(c.devices))
183183
for _, dev := range c.devices {
184184
lines = append(lines, fmt.Sprintf("%s %d", dev, value))
185185
}
@@ -196,6 +196,9 @@ func writeLimit(limitPath string, content []string) error {
196196
}
197197

198198
for _, l := range content {
199+
if l == "" {
200+
continue
201+
}
199202
err = os.WriteFile(limitPath, []byte(l), 0644)
200203
if err != nil {
201204
log.WithError(err).WithField("limitPath", limitPath).WithField("line", l).Warn("cannot write limit")

0 commit comments

Comments
 (0)