This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pipelines / ssh / logstream.go
878 B 47 lines
1package ssh 2 3import ( 4 "context" 5 "time" 6 7 "tangled.org/core/api/tangled" 8) 9 10type step struct { 11 id int64 12 name string 13 command string 14 lines []string 15 startTime time.Time 16 endTime time.Time 17 finished bool 18} 19 20type logDoneMsg struct { 21 err error 22} 23 24type logEventMsg struct { 25 ev *tangled.CiSubscribePipelineLogs_Event 26 events chan *tangled.CiSubscribePipelineLogs_Event 27 done chan error 28} 29 30type eventScheduler struct { 31 ch chan *tangled.CiSubscribePipelineLogs_Event 32} 33 34func newEventScheduler() *eventScheduler { 35 return &eventScheduler{ch: make(chan *tangled.CiSubscribePipelineLogs_Event, 1024)} 36} 37 38func (s *eventScheduler) AddWork(ctx context.Context, _ string, v *tangled.CiSubscribePipelineLogs_Event) error { 39 select { 40 case s.ch <- v: 41 return nil 42 case <-ctx.Done(): 43 return ctx.Err() 44 } 45} 46 47func (s *eventScheduler) Shutdown() { close(s.ch) }