clean up
This commit is contained in:
parent
66f4191c5f
commit
44d20eb983
10 changed files with 319 additions and 72 deletions
10
download.go
10
download.go
|
@ -11,9 +11,9 @@ import (
|
|||
)
|
||||
|
||||
// DownloadPackageFromAppIndex selects and downloads the correct package from the APPINDEX.
|
||||
func DownloadPackageFromAppIndex(appIndexPath string, packageName string, release string, pkgType string, destDir string) error {
|
||||
func DownloadPackageFromAppIndex(packageName string, release string, pkgType string, destDir string) error {
|
||||
// Parse the APPINDEX
|
||||
entries, err := ParseAppIndex(appIndexPath)
|
||||
entries, err := GetIndex()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse APPINDEX: %w", err)
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ func DownloadPackageFromAppIndex(appIndexPath string, packageName string, releas
|
|||
|
||||
expectedFilePath := filepath.Join(destDir, expectedFileName)
|
||||
|
||||
// I dont know why is this happening, I dont want to know but sometimes some process is helding up the donwloaded files so thats why it retries here
|
||||
maxRetries := 5
|
||||
// I dont know why is this happening, I dont want to know but sometimes some process is helding up the downloaded files so thats why it retries here
|
||||
maxRetries := 10
|
||||
for i := 0; i < maxRetries; i++ {
|
||||
err = os.Rename(downloadedFilePath, expectedFilePath)
|
||||
if err == nil {
|
||||
|
@ -115,7 +115,7 @@ func DownloadPackageFromAppIndex(appIndexPath string, packageName string, releas
|
|||
f.Close()
|
||||
|
||||
if i < maxRetries-1 {
|
||||
time.Sleep(500 * time.Millisecond) // Wait before retrying
|
||||
time.Sleep(250 * time.Millisecond) // Wait before retrying
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue