feat: update jobs

This commit is contained in:
Rogee
2025-05-07 20:48:43 +08:00
parent e923f8c7c5
commit 1199118fb4
5 changed files with 27 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ import (
"quyun/providers/app"
"quyun/providers/job"
"github.com/pkg/errors"
. "github.com/riverqueue/river"
"github.com/samber/lo"
log "github.com/sirupsen/logrus"
@@ -99,7 +100,7 @@ func (w *PublishDraftPostsWorker) Work(ctx context.Context, job *Job[PublishDraf
}
if err := models.Posts.Create(ctx, post); err != nil {
log.Errorf("Error creating post: %v", err)
return JobCancel(err)
return errors.Wrap(err, "create post")
}
log.Infof("Post created successfully with ID: %d", post.ID)