chore(queue): upgrade queue package and add metrics (#673)

* chore(queue): upgrade queue package and add metrics

add new metrics

	BusyWorkers    *prometheus.Desc
	SuccessTasks   *prometheus.Desc
	FailureTasks   *prometheus.Desc
	SubmittedTasks *prometheus.Desc

fix https://github.com/appleboy/gorush/issues/672

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: update go version

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2022-05-05 13:56:28 +08:00
committed by GitHub
parent 2bba4b4fc4
commit a45769c24f
14 changed files with 167 additions and 146 deletions

View File

@@ -13,7 +13,7 @@ import (
"github.com/appleboy/gorush/logx"
"github.com/appleboy/go-fcm"
"github.com/golang-queue/queue"
qcore "github.com/golang-queue/queue/core"
jsoniter "github.com/json-iterator/go"
"github.com/msalihkarakasli/go-hms-push/push/model"
)
@@ -233,7 +233,7 @@ func CheckPushConf(cfg *config.ConfYaml) error {
}
// SendNotification send notification
func SendNotification(req queue.QueuedMessage, cfg *config.ConfYaml) (resp *ResponsePush, err error) {
func SendNotification(req qcore.QueuedMessage, cfg *config.ConfYaml) (resp *ResponsePush, err error) {
v, ok := req.(*PushNotification)
if !ok {
if err = json.Unmarshal(req.Bytes(), &v); err != nil {
@@ -263,8 +263,8 @@ func SendNotification(req queue.QueuedMessage, cfg *config.ConfYaml) (resp *Resp
}
// Run send notification
var Run = func(cfg *config.ConfYaml) func(ctx context.Context, msg queue.QueuedMessage) error {
return func(ctx context.Context, msg queue.QueuedMessage) error {
var Run = func(cfg *config.ConfYaml) func(ctx context.Context, msg qcore.QueuedMessage) error {
return func(ctx context.Context, msg qcore.QueuedMessage) error {
_, err := SendNotification(msg, cfg)
return err
}