Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions supernode/node/action/server/cascade/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
)

func initializeHasherAndTempFile() (*blake3.Hasher, *os.File, string, error) {
hasher := blake3.New(32, nil)
hasher := blake3.New(32, nil)

tempFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("cascade-upload-%d.tmp", os.Getpid()))
tempFile, err := os.Create(tempFilePath)
if err != nil {
return nil, nil, "", fmt.Errorf("could not create temp file: %w", err)
}
// Create a unique temp file to avoid collisions across concurrent calls
tempFile, err := os.CreateTemp("", "cascade-upload-*")
if err != nil {
return nil, nil, "", fmt.Errorf("could not create temp file: %w", err)
}

return hasher, tempFile, tempFilePath, nil
return hasher, tempFile, tempFile.Name(), nil
}

func replaceTempDirWithTaskDir(taskID, tempFilePath string, tempFile *os.File) (targetPath string, err error) {
Expand Down