2025-08-21 15:04:39: merge [main:601a690901951343a4dc145282f04732093acfac];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s

This commit is contained in:
txix committed 2025-08-21 15:04:39 +03:00
1 parent 32466576b0
commit 14bd29e48f
6 files changed
+110 -104

No files matched your search

+4 -3
View File
@@ -6,6 +6,7 @@ import (
"github.com/pkg/errors"
"github.com/txix-open/bgjob"
"github.com/txix-open/isp-kit/bgjobx/handler"
"github.com/txix-open/isp-kit/log"
"msp-admin-service/conf"
)
@@ -38,13 +39,13 @@ func NewService(
}
}
func (s Service) Handle(ctx context.Context, _ bgjob.Job) bgjob.Result {
func (s Service) Handle(ctx context.Context, _ bgjob.Job) handler.Result {
err := s.deleteOldAudit(ctx)
if err != nil {
return bgjob.Retry(defaultRetryTimeout, errors.WithMessage(err, "sync state with worker"))
return handler.Retry(defaultRetryTimeout, errors.WithMessage(err, "sync state with worker"))
}
return bgjob.Reschedule(s.syncPeriod)
return handler.Reschedule(s.syncPeriod)
}
func (s Service) deleteOldAudit(ctx context.Context) error {
+4 -3
View File
@@ -6,6 +6,7 @@ import (
"github.com/pkg/errors"
"github.com/txix-open/bgjob"
"github.com/txix-open/isp-kit/bgjobx/handler"
"github.com/txix-open/isp-kit/log"
"msp-admin-service/conf"
"msp-admin-service/entity"
@@ -54,15 +55,15 @@ func NewInactiveBlocker(
}
}
func (w Service) Handle(ctx context.Context, _ bgjob.Job) bgjob.Result {
func (w Service) Handle(ctx context.Context, _ bgjob.Job) handler.Result {
ctx = log.ToContext(ctx, log.String("worker", "inactiveBlocker"))
w.logger.Debug(ctx, "begin work")
err := w.do(ctx)
if err != nil {
return bgjob.Retry(defaultRetryTimeout, errors.WithMessage(err, "sync state with worker"))
return handler.Retry(defaultRetryTimeout, errors.WithMessage(err, "sync state with worker"))
}
w.logger.Debug(ctx, "end work")
return bgjob.Reschedule(w.syncPeriod)
return handler.Reschedule(w.syncPeriod)
}
func (w Service) do(ctx context.Context) error {