-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Warehouse redesign part4 (#2893)
Warehouses redesign part4 (continuation of #2890): - handle snowflake parameters using computed values - handle waiting for suspension Common: - move retry to utils (to avoid dependencies cycle) Still missing (next PRs): - encapsulate 3-value boolean logic - extract and generalize part of read logic - Move GetPropertyAsPointerWithPossibleZeroValues and use for database parameters too
- Loading branch information
1 parent
7f6c657
commit d525fd9
Showing
10 changed files
with
211 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package util | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"time" | ||
) | ||
|
||
func Retry(attempts int, sleepDuration time.Duration, f func() (error, bool)) error { | ||
for i := 0; i < attempts; i++ { | ||
err, done := f() | ||
if err != nil { | ||
return err | ||
} | ||
if done { | ||
return nil | ||
} else { | ||
log.Printf("[INFO] operation not finished yet, retrying in %v seconds\n", sleepDuration.Seconds()) | ||
time.Sleep(sleepDuration) | ||
} | ||
} | ||
return fmt.Errorf("giving up after %v attempts", attempts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.