1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 type throttle struct {
21 func (t *throttle) Acquire() {
22 t.setupOnce.Do(func() { t.ch = make(chan bool, t.Max) })
27 func (t *throttle) Release() {
32 func (t *throttle) Report(err error) {
34 t.errorOnce.Do(func() { t.err.Store(err) })
38 func (t *throttle) Err() error {
39 err, _ := t.err.Load().(error)
43 func (t *throttle) Wait() error {
48 func (t *throttle) Go(f func() error) error {