mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-25 01:40:30 +00:00
75513575be
* store dependency's in git * since we vendor ... rm tech-depts * aad make target 'vendor' to update vendor folder (manual task)
27 lines
647 B
Cheetah
27 lines
647 B
Cheetah
{{.Label}}:
|
|
switch timeout{{.Sfx}} := z.EncBasicHandle().ChanRecvTimeout; {
|
|
case timeout{{.Sfx}} == 0: // only consume available
|
|
for {
|
|
select {
|
|
case b{{.Sfx}} := <-{{.Chan}}:
|
|
{{ .Slice }} = append({{.Slice}}, b{{.Sfx}})
|
|
default:
|
|
break {{.Label}}
|
|
}
|
|
}
|
|
case timeout{{.Sfx}} > 0: // consume until timeout
|
|
tt{{.Sfx}} := time.NewTimer(timeout{{.Sfx}})
|
|
for {
|
|
select {
|
|
case b{{.Sfx}} := <-{{.Chan}}:
|
|
{{.Slice}} = append({{.Slice}}, b{{.Sfx}})
|
|
case <-tt{{.Sfx}}.C:
|
|
// close(tt.C)
|
|
break {{.Label}}
|
|
}
|
|
}
|
|
default: // consume until close
|
|
for b{{.Sfx}} := range {{.Chan}} {
|
|
{{.Slice}} = append({{.Slice}}, b{{.Sfx}})
|
|
}
|
|
}
|