mirror of
https://github.com/ChronosX88/go-throttle.git
synced 2024-12-30 19:31:47 +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,
|
||||
queueChan: make(chan *req, cfg.MaxCapacity),
|
||||
config: *cfg,
|
||||
running: false,
|
||||
ctx: ctx,
|
||||
}
|
||||
t.run()
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *Throttle) run() {
|
||||
|
Loading…
Reference in New Issue
Block a user