Open chaos0108 opened 3 years ago
I had try change the parameters, but wasn't work.
package main
import (
"fmt"
"github.com/benmanns/goworker"
"log"
"sso-api/config"
"strconv"
)
//func myFunc(queue string, args ...interface{}) error {
// log.Printf("From %s, %v\n", queue, args)
// return nil
//}
func callbackUrl(queue string, args ...interface{}) error {
log.Printf("From %s, %v\n", queue, args)
return nil
}
func init() {
_ = goworker.Init()
settings := goworker.WorkerSettings{
URI: config.Goworker.GoworkerRedisUri,
Connections: 50,
Queues: []string{config.Goworker.GoworkerQueueName},
UseNumber: true,
ExitOnComplete: false,
Concurrency: 2,
Namespace: config.Goworker.GoworkerNamespace,
Interval: 1000000000,
}
goworker.SetSettings(settings)
//goworker.Register("MyClass", myFunc)
goworker.Register("Callback", callbackUrl)
}
func main() {
if err := goworker.Work(); err != nil {
fmt.Println("Error:", err)
}
}
@chaos0108
Please use IntervalFloat
instead of Interval
, because it set Interval
by IntervalFloat
in Init().
And the unit of IntervalFloat is Second
.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
489 chaosii 20 0 1110252 17164 12524 S 54.2 0.1 1:38.45 background_work