Skip to content

Commit 9bdc0a5

Browse files
utam0kroboquat
authored andcommitted
ws-daemon: Add the disposal in the priority plugin when the workspace has gone
1 parent bc4d4c3 commit 9bdc0a5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,14 @@ func (c *ProcessPriorityV2) Type() Version { return Version2 }
5151
func (c *ProcessPriorityV2) Apply(ctx context.Context, opts *PluginOptions) error {
5252
fullCgroupPath := filepath.Join(opts.BasePath, opts.CgroupPath)
5353

54-
_, err := os.Stat(fullCgroupPath)
55-
if errors.Is(err, fs.ErrNotExist) {
56-
return xerrors.Errorf("cannot read cgroup directory %s: %w", fullCgroupPath, err)
57-
}
58-
5954
go func() {
6055
time.Sleep(10 * time.Second)
6156

6257
data, err := ioutil.ReadFile(filepath.Join(fullCgroupPath, "workspace", "user", "cgroup.procs"))
63-
if err != nil {
58+
if errors.Is(err, fs.ErrNotExist) {
59+
log.WithField("path", fullCgroupPath).WithError(err).Warn("the target cgroup has gone")
60+
return
61+
} else if err != nil {
6462
log.WithField("path", fullCgroupPath).WithError(err).Errorf("cannot read cgroup.procs file")
6563
return
6664
}

0 commit comments

Comments
 (0)