Make throttle listener running on instantiating

This commit is contained in:
ChronosX88 2021-01-25 17:38:56 +03:00
parent 7cc2c6e929
commit ab73418b18
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -28,13 +28,15 @@ func NewThrottle(ctx context.Context, cfg *Config) *Throttle {
} }
} }
return &Throttle{ t := &Throttle{
lastTimestamp: -1, lastTimestamp: -1,
queueChan: make(chan *req, cfg.MaxCapacity), queueChan: make(chan *req, cfg.MaxCapacity),
config: *cfg, config: *cfg,
running: false, running: false,
ctx: ctx, ctx: ctx,
} }
t.run()
return t
} }
func (t *Throttle) run() { func (t *Throttle) run() {