Skip to content

Commit

Permalink
Merge pull request #361 from Zibbp/fixes-2024-02-04
Browse files Browse the repository at this point in the history
Fixes 2024 02 04
  • Loading branch information
Zibbp authored Feb 5, 2024
2 parents 0efea71 + 0a00298 commit 215e0be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/activities/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func DownloadTwitchLiveThumbnails(ctx context.Context, input dto.ArchiveVideoInp
if dbErr != nil {
return dbErr
}
return fmt.Errorf("no stream found for channel %s", input.Channel.Name)
return temporal.NewApplicationError(fmt.Sprintf("no stream found for channel %s", input.Channel.Name), "", nil)
}

twitchVideo := stream.Data[0]
Expand Down
30 changes: 30 additions & 0 deletions internal/workflows/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ func ArchiveLiveVideoWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput)
func CreateDirectoryWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 10 * time.Second,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
BackoffCoefficient: 2,
MaximumAttempts: 5,
MaximumInterval: 15 * time.Minute,
},
})

err := workflow.ExecuteActivity(ctx, activities.CreateDirectory, input).Get(ctx, nil)
Expand All @@ -189,6 +195,12 @@ func CreateDirectoryWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput)
func DownloadTwitchThumbnailsWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 10 * time.Second,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
BackoffCoefficient: 2,
MaximumAttempts: 5,
MaximumInterval: 15 * time.Minute,
},
})

err := workflow.ExecuteActivity(ctx, activities.DownloadTwitchThumbnails, input).Get(ctx, nil)
Expand All @@ -208,6 +220,12 @@ func DownloadTwitchThumbnailsWorkflow(ctx workflow.Context, input dto.ArchiveVid
func DownloadTwitchLiveThumbnailsWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 10 * time.Second,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
BackoffCoefficient: 2,
MaximumAttempts: 2,
MaximumInterval: 15 * time.Minute,
},
})

err := workflow.ExecuteActivity(ctx, activities.DownloadTwitchLiveThumbnails, input).Get(ctx, nil)
Expand All @@ -227,6 +245,12 @@ func DownloadTwitchLiveThumbnailsWorkflow(ctx workflow.Context, input dto.Archiv
func SaveTwitchVideoInfoWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 10 * time.Second,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
BackoffCoefficient: 2,
MaximumAttempts: 5,
MaximumInterval: 15 * time.Minute,
},
})

err := workflow.ExecuteActivity(ctx, activities.SaveTwitchVideoInfo, input).Get(ctx, nil)
Expand All @@ -246,6 +270,12 @@ func SaveTwitchVideoInfoWorkflow(ctx workflow.Context, input dto.ArchiveVideoInp
func SaveTwitchLiveVideoInfoWorkflow(ctx workflow.Context, input dto.ArchiveVideoInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 10 * time.Second,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
BackoffCoefficient: 2,
MaximumAttempts: 3,
MaximumInterval: 15 * time.Minute,
},
})

err := workflow.ExecuteActivity(ctx, activities.SaveTwitchLiveVideoInfo, input).Get(ctx, nil)
Expand Down

0 comments on commit 215e0be

Please sign in to comment.