Skip to content

Commit cd71f68

Browse files
committed
Cleans up non-pushd file handling.
1 parent 4a76c15 commit cd71f68

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

processing_handler.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -433,20 +433,20 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
433433
checkErr(ctx, "processing", err)
434434
checkErr(ctx, "timeout", router.CheckTimeout(ctx))
435435

436-
// TODO: only run this is pushd_handler used?
437-
438-
// copy imgData for thread safety
439-
imgDataForS3 := make([]byte, len(resultData.Data))
440-
copy(imgDataForS3, resultData.Data)
441-
uploaded := beforeResponse(imgDataForS3, cachePath)
436+
var uploaded chan bool
437+
if cachePath != "" {
438+
// copy imgData for thread safety
439+
imgDataForS3 := make([]byte, len(resultData.Data))
440+
copy(imgDataForS3, resultData.Data)
441+
uploaded = beforeResponse(imgDataForS3, cachePath)
442+
}
442443

443444
defer resultData.Close()
444445

445446
respondWithImage(reqID, r, rw, statusCode, resultData, po, imageURL, originData)
446447

447-
// Waiting for S3 Upload to finish.
448-
// TODO: make this more elegant?
449448
if cachePath != "" {
449+
// Waiting for S3 Upload to finish.
450450
<-uploaded
451451
}
452452
}

0 commit comments

Comments
 (0)