-
Notifications
You must be signed in to change notification settings - Fork 925
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
Avoid race between operation and events listener #12885
Changes from 1 commit
f26353c
55de107
1085085
72bd241
5017a40
861f757
c3a3f44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,8 +207,10 @@ func (r *ProtocolLXD) tryCreateContainer(req api.ContainersPost, urls []string) | |
|
||
rop.targetOp = op | ||
|
||
for _, handler := range rop.handlers { | ||
_, _ = rop.targetOp.AddHandler(handler) | ||
if r.supportsAuthentication { | ||
for _, handler := range rop.handlers { | ||
_, _ = rop.targetOp.AddHandler(handler) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be ignoring the error returned from AddHandler? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've seen this sort of thing all over the place wherever we try to set up an events listener with |
||
} | ||
} | ||
|
||
err = rop.targetOp.Wait() | ||
|
@@ -570,8 +572,10 @@ func (r *ProtocolLXD) tryMigrateContainer(source InstanceServer, name string, re | |
|
||
rop.targetOp = op | ||
|
||
for _, handler := range rop.handlers { | ||
_, _ = rop.targetOp.AddHandler(handler) | ||
if source.SupportsAuthentication() { | ||
for _, handler := range rop.handlers { | ||
_, _ = rop.targetOp.AddHandler(handler) | ||
} | ||
} | ||
|
||
err = rop.targetOp.Wait() | ||
|
@@ -1262,8 +1266,10 @@ func (r *ProtocolLXD) tryMigrateContainerSnapshot(source InstanceServer, contain | |
|
||
rop.targetOp = op | ||
|
||
for _, handler := range rop.handlers { | ||
_, _ = rop.targetOp.AddHandler(handler) | ||
if source.SupportsAuthentication() { | ||
for _, handler := range rop.handlers { | ||
_, _ = rop.targetOp.AddHandler(handler) | ||
} | ||
} | ||
|
||
err = rop.targetOp.Wait() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use
SupportsAuthentication
everywhere inclient
so that when we search for usage of this function we get a clear picture of the usage.