Skip to content

Commit

Permalink
Update kit version
Browse files Browse the repository at this point in the history
  • Loading branch information
neoxelox committed Apr 24, 2024
1 parent 2511902 commit a9a8b77
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
27 changes: 14 additions & 13 deletions cmd/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,20 @@ func NewWorker(ctx context.Context, config config.Config) (*Worker, error) {
}

worker := kit.NewWorker(observer, errorHandler, kit.WorkerConfig{
Queues: config.Worker.Queues,
Concurrency: kitUtil.Pointer(config.Worker.Concurrency),
StrictPriority: kitUtil.Pointer(config.Worker.StrictPriority),
StopTimeout: kitUtil.Pointer(config.Worker.StopTimeout),
TimeZone: kitUtil.Pointer(config.Service.TimeZone),
CacheHost: config.Cache.Host,
CachePort: config.Cache.Port,
CacheSSLMode: config.Cache.SSLMode,
CachePassword: config.Cache.Password,
CacheMaxConns: kitUtil.Pointer(config.Cache.MaxConns),
CacheReadTimeout: kitUtil.Pointer(config.Cache.ReadTimeout),
CacheWriteTimeout: kitUtil.Pointer(config.Cache.WriteTimeout),
CacheDialTimeout: kitUtil.Pointer(config.Cache.DialTimeout),
Queues: config.Worker.Queues,
Concurrency: kitUtil.Pointer(config.Worker.Concurrency),
StrictPriority: kitUtil.Pointer(config.Worker.StrictPriority),
StopTimeout: kitUtil.Pointer(config.Worker.StopTimeout),
TimeZone: kitUtil.Pointer(config.Service.TimeZone),
ScheduleDefaultRetry: kitUtil.Pointer(0),
CacheHost: config.Cache.Host,
CachePort: config.Cache.Port,
CacheSSLMode: config.Cache.SSLMode,
CachePassword: config.Cache.Password,
CacheMaxConns: kitUtil.Pointer(config.Cache.MaxConns),
CacheReadTimeout: kitUtil.Pointer(config.Cache.ReadTimeout),
CacheWriteTimeout: kitUtil.Pointer(config.Cache.WriteTimeout),
CacheDialTimeout: kitUtil.Pointer(config.Cache.DialTimeout),
})

observerMiddleware := kitMiddleware.NewObserver(observer, kitMiddleware.ObserverConfig{})
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/leporo/sqlf v1.4.0
github.com/mkideal/cli v0.2.7
github.com/neoxelox/errors v0.2.0
github.com/neoxelox/kit v0.33.0
github.com/neoxelox/kit v0.34.0
github.com/rs/xid v1.5.0
golang.org/x/text v0.14.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ github.com/neoxelox/errors v0.2.0 h1:AhvCMJAjUBFCP3PgZHbY6SS8Sc9fxx/DiawU5Cd5RxE
github.com/neoxelox/errors v0.2.0/go.mod h1:gCPnC7z8Qwswwz5Usv3WORxvan9Q6WSrDTvzaQyl7oM=
github.com/neoxelox/gilk v0.5.0 h1:Knw/TgSUnwPDIRJbqoTmG98gYsmKojNCJ5WAjALoWFc=
github.com/neoxelox/gilk v0.5.0/go.mod h1:Q+WgmSMKWd5UAaVjLSmGPbVD11AmHFhlo3QrPum0vo0=
github.com/neoxelox/kit v0.33.0 h1:9IlIuwVP3Bb+herHpDTLYEA9vFUKGCD1C67LD2hr3U8=
github.com/neoxelox/kit v0.33.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE=
github.com/neoxelox/kit v0.34.0 h1:cO3o17Xwr5dVVKrqoMO/t1J2okJ0WCzuZyA58jgbPSM=
github.com/neoxelox/kit v0.34.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
3 changes: 2 additions & 1 deletion pkg/example/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package example
import (
"context"

"github.com/hibiken/asynq"
"github.com/neoxelox/errors"
"github.com/neoxelox/kit"
"github.com/rs/xid"
Expand Down Expand Up @@ -75,7 +76,7 @@ func (self *ExampleCreator) Create(ctx context.Context, params ExampleCreatorCre

err = self.enqueuer.Enqueue(ctx, ExampleTasksMakeOnboarding, ExampleTasksMakeOnboardingParams{
ID: example.ID,
})
}, asynq.MaxRetry(3))
if err != nil {
self.observer.Error(ctx, err)
}
Expand Down
7 changes: 1 addition & 6 deletions pkg/example/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"

"github.com/hibiken/asynq"
"github.com/neoxelox/errors"
"github.com/neoxelox/kit"

"service/pkg/config"
Expand All @@ -16,10 +15,6 @@ const (
ExampleTasksReconcile = "example:reconcile"
)

var (
ErrExampleTasksGeneric = errors.New("example task failed")
)

type ExampleTasks struct {
config config.Config
observer *kit.Observer
Expand Down Expand Up @@ -50,7 +45,7 @@ func (self *ExampleTasks) MakeOnboarding(ctx context.Context, task *asynq.Task)

example, err := self.exampleRepository.Get(ctx, params.ID)
if err != nil {
return ErrExampleTasksGeneric.Raise().Cause(err)
return err
}

if example == nil {
Expand Down

0 comments on commit a9a8b77

Please sign in to comment.