fix: rename R2 object key prefix from live/ to hls/ for consistency
CI / test (push) Successful in 1m37s
CI / docker (push) Successful in 48s

This commit is contained in:
zwitschi committed 2026-08-11 17:21:53 +02:00
1 parent cca8d77325
commit 926d70dc3c
2 files changed
+9 -9

No files matched your search

+6 -6
View File
@@ -124,7 +124,7 @@ func watchAndPublishSegments(ctx context.Context, hlsOutputDir string) {
time.Sleep(500 * time.Millisecond)
segSequence++
lastSegmentSeq = segSequence
key := "live/" + runID + "/" + filepath.Base(event.Name)
key := "hls/" + runID + "/" + filepath.Base(event.Name)
if err := SyncToR2(event.Name, key); err != nil {
consecutiveFails++
fmt.Printf("Failed to sync segment %s: %v\n", event.Name, err)
@@ -153,15 +153,15 @@ func publishManifest(localManifestPath string) error {
}
// 1. Upload to temp key
if err := SyncToR2(localManifestPath, "live/playlist.m3u8.tmp"); err != nil {
if err := SyncToR2(localManifestPath, "hls/playlist.m3u8.tmp"); err != nil {
return fmt.Errorf("temp manifest upload failed: %w", err)
}
// 2. Atomic copy to final key
_, err := r2Client.CopyObject(context.TODO(), &s3.CopyObjectInput{
Bucket: aws.String(bucket),
CopySource: aws.String(bucket + "/live/playlist.m3u8.tmp"),
Key: aws.String("live/playlist.m3u8"),
CopySource: aws.String(bucket + "/hls/playlist.m3u8.tmp"),
Key: aws.String("hls/playlist.m3u8"),
})
if err != nil {
return fmt.Errorf("manifest atomic swap failed: %w", err)
@@ -704,7 +704,7 @@ func syncLatestToR2(hlsDir string) error {
}
for _, f := range files {
key := "live/" + runID + "/" + filepath.Base(f)
key := "hls/" + runID + "/" + filepath.Base(f)
if err := SyncToR2(f, key); err != nil {
fmt.Printf("Failed to sync %s: %v\n", f, err)
} else {
@@ -714,7 +714,7 @@ func syncLatestToR2(hlsDir string) error {
// Sync init segment to run-specific R2 key
initPath := filepath.Join(hlsDir, "init.mp4")
if err := SyncToR2(initPath, "live/"+runID+"/init.mp4"); err != nil {
if err := SyncToR2(initPath, "hls/"+runID+"/init.mp4"); err != nil {
return err
}
fmt.Println("Synced init.mp4 to R2")