chore: rename gorush to notify package (#609)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2021-07-24 01:56:33 +08:00
committed by GitHub
parent ce6e87639a
commit d9947ea44d
20 changed files with 73 additions and 73 deletions

View File

@@ -4,7 +4,7 @@ import (
"errors"
"runtime"
"github.com/appleboy/gorush/gorush"
"github.com/appleboy/gorush/notify"
"github.com/appleboy/gorush/queue"
)
@@ -84,7 +84,7 @@ func NewWorker(opts ...Option) *Worker {
w := &Worker{
queueNotification: make(chan queue.QueuedMessage, runtime.NumCPU()<<1),
runFunc: func(msg queue.QueuedMessage) error {
gorush.SendNotification(msg)
notify.SendNotification(msg)
return nil
},
}

View File

@@ -5,8 +5,8 @@ import (
"testing"
"time"
"github.com/appleboy/gorush/gorush"
"github.com/appleboy/gorush/logx"
"github.com/appleboy/gorush/notify"
"github.com/appleboy/gorush/queue"
"github.com/stretchr/testify/assert"
@@ -29,7 +29,7 @@ func TestQueueUsage(t *testing.T) {
assert.Equal(t, runtime.NumCPU()<<1, w.Capacity())
assert.Equal(t, 0, w.Usage())
w.Queue(&gorush.PushNotification{})
w.Queue(&notify.PushNotification{})
assert.Equal(t, 1, w.Usage())
}
@@ -38,14 +38,14 @@ func TestMaxCapacity(t *testing.T) {
assert.Equal(t, 2, w.Capacity())
assert.Equal(t, 0, w.Usage())
assert.NoError(t, w.Queue(&gorush.PushNotification{}))
assert.NoError(t, w.Queue(&notify.PushNotification{}))
assert.Equal(t, 1, w.Usage())
assert.NoError(t, w.Queue(&gorush.PushNotification{}))
assert.NoError(t, w.Queue(&notify.PushNotification{}))
assert.Equal(t, 2, w.Usage())
assert.Error(t, w.Queue(&gorush.PushNotification{}))
assert.Error(t, w.Queue(&notify.PushNotification{}))
assert.Equal(t, 2, w.Usage())
err := w.Queue(&gorush.PushNotification{})
err := w.Queue(&notify.PushNotification{})
assert.Equal(t, errMaxCapacity, err)
}