mirror of
https://github.com/ChronosX88/go-throttle.git
synced 2024-11-22 12:22:19 +00:00
Make throttle listener running on instantiating
This commit is contained in:
parent
7cc2c6e929
commit
ab73418b18
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user