55 lines
1.0 KiB
Go
55 lines
1.0 KiB
Go
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
|
|
}
|