package runner import ( "amadan.net/oficina/equipo/internal/runnerproto" "context" ) func (s *Supervisor) uploadDirectEvent(ctx context.Context, r *attemptState, e Event) error { q := runnerproto.RunnerRequest{Version: 2, AssignmentID: e.AssignmentID, Scope: e.Scope, Handle: e.Handle, RequestID: e.ID, ActionID: e.ActionID} q.Event, _ = runnerproto.Marshal(e) return s.api.Call(ctx, "events", q, nil) } func finishDirectStream(ctx context.Context, close func() error, done chan error, drain func(context.Context) error) error { if err := close(); err != nil { return err } select { case <-ctx.Done(): return ctx.Err() case err := <-done: done <- err if err != nil { return err } } return drain(ctx) }