Add partial context support to handleUserUpdate
More plumbing needed to make sure we don't block too long waiting for the reply.
This commit is contained in:
parent
22f9ce1b86
commit
e3b1930bf2
@ -813,11 +813,17 @@ func handleUserUpdate(ctx context.Context, dc *downstreamConn, params []string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done := make(chan error, 1)
|
done := make(chan error, 1)
|
||||||
u.events <- eventUserUpdate{
|
event := eventUserUpdate{
|
||||||
password: hashed,
|
password: hashed,
|
||||||
admin: admin,
|
admin: admin,
|
||||||
done: done,
|
done: done,
|
||||||
}
|
}
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
case u.events <- event:
|
||||||
|
}
|
||||||
|
// TODO: send context to the other side
|
||||||
if err := <-done; err != nil {
|
if err := <-done; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user