INNER CODE UNIT · Go

uploadFileWithRetries

secureCodeBox/secureCodeBox · lurker/main.go:76

func uploadFileWithRetries(path, url string) error {
	attempts := len(uploadBackoffs) + 1

	var err error
	for attempt := 1; attempt <= attempts; attempt++ {
		var retryable bool
		err, retryable = uploadFile(path, url)
		if err == nil {
			return nil
		}

		if !retryable || attempt == attempts {
			break
		}

		backoff := uploadBackoffs[attempt-1]
		log.Printf("Upload attempt %d of %d failed: %v. Retrying in %s", attempt, attempts, err, backoff)
		sleep(backoff)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…