feat: add some new features
This commit is contained in:
54
backend/app/jobs/post_video_cut.go
Normal file
54
backend/app/jobs/post_video_cut.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package jobs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
_ "git.ipao.vip/rogeecn/atom"
|
||||
_ "git.ipao.vip/rogeecn/atom/contracts"
|
||||
. "github.com/riverqueue/river"
|
||||
)
|
||||
|
||||
var (
|
||||
_ JobArgs = (*PostVideoCutJob)(nil)
|
||||
_ JobArgsWithInsertOpts = (*PostVideoCutJob)(nil)
|
||||
)
|
||||
|
||||
type PostVideoCutJob struct {
|
||||
PostID int64
|
||||
TenantID int64
|
||||
UserID int64
|
||||
Hash string
|
||||
}
|
||||
|
||||
// InsertOpts implements JobArgsWithInsertOpts.
|
||||
func (s PostVideoCutJob) InsertOpts() InsertOpts {
|
||||
return InsertOpts{
|
||||
Queue: QueueDefault,
|
||||
Priority: PriorityDefault,
|
||||
// UniqueOpts: UniqueOpts{
|
||||
// ByArgs: true,
|
||||
// },
|
||||
}
|
||||
}
|
||||
|
||||
func (PostVideoCutJob) Kind() string {
|
||||
return "PostVideoCutJob"
|
||||
}
|
||||
|
||||
// worker
|
||||
|
||||
var _ Worker[PostVideoCutJob] = (*PostVideoCutJobWorker)(nil)
|
||||
|
||||
// @provider(job)
|
||||
type PostVideoCutJobWorker struct {
|
||||
WorkerDefaults[PostVideoCutJob]
|
||||
}
|
||||
|
||||
func (w *PostVideoCutJobWorker) NextRetry(job *Job[PostVideoCutJob]) time.Time {
|
||||
return time.Now().Add(5 * time.Second)
|
||||
}
|
||||
|
||||
func (w *PostVideoCutJobWorker) Work(ctx context.Context, job *Job[PostVideoCutJob]) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user