Skip to content

Commit

Permalink
[lxd-import] client: Always use event listener for operations.
Browse files Browse the repository at this point in the history
When long polling the operation wait endpoint, we can never guarantee
that the request will not time out for very long operations (e.g. an
exec session) because intermediate proxies or load balancers may timeout
the request if there is no activity. This commit changes the
`useEventListener` argument to getOperations to true for all requests.
Regardless of whether the `operation_wait` API extension is present.

Signed-off-by: Mark Laing <mark.laing@canonical.com>
  • Loading branch information
markylaing authored and stgraber committed Dec 8, 2023
1 parent a4f4de2 commit 2a07257
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions client/incus_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,7 @@ func (r *ProtocolIncus) ExecInstance(instanceName string, exec api.InstanceExecP
}

// Send the request
useEventListener := r.CheckExtension("operation_wait") != nil
op, _, err := r.queryOperation("POST", uri, exec, "", useEventListener)
op, _, err := r.queryOperation("POST", uri, exec, "", true)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 2a07257

Please sign in to comment.