Skip to content

Commit

Permalink
fix: Check download path before downloading
Browse files Browse the repository at this point in the history
If the path exists, we have already attempted to download the results.
  • Loading branch information
bgins committed Oct 24, 2024
1 parent 55bb8ba commit f46c781
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/jobcreator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package jobcreator

import (
"context"
"errors"
"fmt"
"io/fs"
"os"
"time"

"github.com/lilypad-tech/lilypad/pkg/data"
Expand Down Expand Up @@ -325,10 +328,16 @@ func (controller *JobCreatorController) checkResults() error {
return err
}
} else {
err := controller.downloadResult(dealContainer)
if err != nil {
controller.log.Error("failed to download results", err)
return err
// We check for all completed deals, including deals whose results
// we have already downloaded. Check the download path and download
// if results do not exist.
downloadPath := solver.GetDownloadsFilePath(dealContainer.ID)
if _, err := os.Stat(downloadPath); errors.Is(err, fs.ErrNotExist) {
err := controller.downloadResult(dealContainer)
if err != nil {
controller.log.Error("failed to download results", err)
return err
}
}
}
}
Expand Down

0 comments on commit f46c781

Please sign in to comment.