Only initial MaxConcurrentIOSPushes once. (#591)
This commit is contained in:
@@ -3,20 +3,18 @@ package simple
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/appleboy/gorush/config"
|
||||
"github.com/appleboy/gorush/gorush"
|
||||
)
|
||||
|
||||
// Worker for simple queue using channel
|
||||
type Worker struct {
|
||||
cfg config.ConfYaml
|
||||
queueNotification chan gorush.PushNotification
|
||||
}
|
||||
|
||||
// Run start the worker
|
||||
func (s *Worker) Run(_ chan struct{}) {
|
||||
for notification := range s.queueNotification {
|
||||
gorush.SendNotification(s.cfg, notification)
|
||||
gorush.SendNotification(notification)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,15 +43,9 @@ func (s *Worker) Enqueue(job interface{}) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Config update current config
|
||||
func (s *Worker) Config(cfg config.ConfYaml) {
|
||||
s.cfg = cfg
|
||||
}
|
||||
|
||||
// NewWorker for struct
|
||||
func NewWorker(cfg config.ConfYaml) *Worker {
|
||||
func NewWorker(num int) *Worker {
|
||||
return &Worker{
|
||||
cfg: cfg,
|
||||
queueNotification: make(chan gorush.PushNotification, cfg.Core.QueueNum),
|
||||
queueNotification: make(chan gorush.PushNotification, num),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user