This commit is contained in:
Rogee
2025-01-15 15:55:49 +08:00
parent 9002862415
commit 13566cfa38
13 changed files with 1092 additions and 872 deletions

View File

@@ -0,0 +1,52 @@
package jobs
import (
"context"
"time"
_ "git.ipao.vip/rogeecn/atom"
_ "git.ipao.vip/rogeecn/atom/contracts"
. "github.com/riverqueue/river"
)
var (
_ JobArgs = VideoCut{}
_ JobArgsWithInsertOpts = VideoCut{}
)
type VideoCut struct {
PostID int64 `json:"post_id"`
Hash string `json:"hash"`
TenantID int64 `json:"tenant_id"`
UserID int64 `json:"user_id"`
}
// InsertOpts implements JobArgsWithInsertOpts.
func (s VideoCut) InsertOpts() InsertOpts {
return InsertOpts{
Queue: QueueDefault,
Priority: PriorityDefault,
UniqueOpts: UniqueOpts{
ByArgs: true,
},
}
}
func (VideoCut) Kind() string {
return "VideoCut"
}
var _ Worker[VideoCut] = (*VideoCutWorker)(nil)
// @provider(job)
type VideoCutWorker struct {
WorkerDefaults[VideoCut]
}
func (w *VideoCutWorker) NextRetry(job *Job[VideoCut]) time.Time {
return time.Now().Add(5 * time.Second)
}
func (w *VideoCutWorker) Work(ctx context.Context, job *Job[VideoCut]) error {
return nil
}