add jobs
This commit is contained in:
52
backend/app/jobs/VideoExtractAudio.go
Normal file
52
backend/app/jobs/VideoExtractAudio.go
Normal 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 = VideoExtractAudio{}
|
||||
_ JobArgsWithInsertOpts = VideoExtractAudio{}
|
||||
)
|
||||
|
||||
type VideoExtractAudio 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 VideoExtractAudio) InsertOpts() InsertOpts {
|
||||
return InsertOpts{
|
||||
Queue: QueueDefault,
|
||||
Priority: PriorityDefault,
|
||||
UniqueOpts: UniqueOpts{
|
||||
ByArgs: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (VideoExtractAudio) Kind() string {
|
||||
return "VideoExtractAudio"
|
||||
}
|
||||
|
||||
var _ Worker[VideoExtractAudio] = (*VideoExtractAudioWorker)(nil)
|
||||
|
||||
// @provider(job)
|
||||
type VideoExtractAudioWorker struct {
|
||||
WorkerDefaults[VideoExtractAudio]
|
||||
}
|
||||
|
||||
func (w *VideoExtractAudioWorker) NextRetry(job *Job[VideoExtractAudio]) time.Time {
|
||||
return time.Now().Add(5 * time.Minute)
|
||||
}
|
||||
|
||||
func (w *VideoExtractAudioWorker) Work(ctx context.Context, job *Job[VideoExtractAudio]) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user