Cancel event subscribe context in Wait.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
7e0063320c
commit
8fae8a5b77
@ -69,7 +69,9 @@ func (p *process) Kill(ctx context.Context, s syscall.Signal) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *process) Wait(ctx context.Context) (uint32, error) {
|
func (p *process) Wait(ctx context.Context) (uint32, error) {
|
||||||
eventstream, err := p.task.client.EventService().Subscribe(ctx, &eventsapi.SubscribeRequest{
|
cancellable, cancel := context.WithCancel(ctx)
|
||||||
|
defer cancel()
|
||||||
|
eventstream, err := p.task.client.EventService().Subscribe(cancellable, &eventsapi.SubscribeRequest{
|
||||||
Filters: []string{"topic==" + runtime.TaskExitEventTopic},
|
Filters: []string{"topic==" + runtime.TaskExitEventTopic},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
4
task.go
4
task.go
@ -167,7 +167,9 @@ func (t *task) Status(ctx context.Context) (Status, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *task) Wait(ctx context.Context) (uint32, error) {
|
func (t *task) Wait(ctx context.Context) (uint32, error) {
|
||||||
eventstream, err := t.client.EventService().Subscribe(ctx, &eventsapi.SubscribeRequest{
|
cancellable, cancel := context.WithCancel(ctx)
|
||||||
|
defer cancel()
|
||||||
|
eventstream, err := t.client.EventService().Subscribe(cancellable, &eventsapi.SubscribeRequest{
|
||||||
Filters: []string{"topic==" + runtime.TaskExitEventTopic},
|
Filters: []string{"topic==" + runtime.TaskExitEventTopic},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user