mirror of
https://github.com/fhmq/hmq.git
synced 2026-09-03 00:04:53 +00:00
* modify * update * add acl * add feature * update dockerfile * add deploy * update * update * plugins * plugins * update * update * update * fixed * remove * fixed * add log * update * fixed * update * fix config * add http api * add http api * resp * add config for work chan * update * fixed * update * disable trace * fixed * change acl * fixed * fixed res * dd * dd * ddd * dd * update * fixed * update * add * fixed * update key * add log * update * format * update * update auth * update * update readme * added * update * fixed * fixed * fix * upade * update * update
28 lines
647 B
Cheetah
28 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}})
|
|
}
|
|
}
|