Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ws-daemon] Check for workspace state #5229

Merged
merged 1 commit into from
Aug 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions components/ws-daemon/pkg/dispatch/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ func (d *Dispatch) Close() error {
defer d.mu.Unlock()

close(d.stopchan)
for _, c := range d.ctxs {
c.Cancel()
for _, state := range d.ctxs {
if state != nil && state.Cancel != nil {
state.Cancel()
}
}

d.ctxs = make(map[string]*workspaceState)

return nil
Expand Down Expand Up @@ -231,7 +234,11 @@ func (d *Dispatch) handlePodUpdate(oldPod, newPod *corev1.Pod) {
go func() {
// no matter if the container was deleted or not - we've lost our guard that was waiting for that to happen.
// Hence, we must stop listening for it to come into existence and cancel the context.
d.Runtime.WaitForContainerStop(waitForPodCtx, workspaceInstanceID)
err := d.Runtime.WaitForContainerStop(waitForPodCtx, workspaceInstanceID)
if err != nil {
log.WithError(err).WithFields(owi).Error("unexpected waiting for container to stop")
}

cancel()
}()

Expand Down