-
Notifications
You must be signed in to change notification settings - Fork 0
Update commit timeout #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,11 +122,8 @@ var commitCmd = &cobra.Command{ | |
| return err | ||
| } | ||
| } else { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | ||
| defer cancel() | ||
|
|
||
| var err error | ||
| commitTransactionFromFlags.Amount, err = calculateAmount(ctx, ".") | ||
| commitTransactionFromFlags.Amount, err = calculateAmount(rootContext, ".") | ||
| if err != nil { | ||
| logrus.Fatalf("Failed to calculate the amount from %q because of the following error: %s", amountDefault, err) | ||
| } | ||
|
Comment on lines
124
to
129
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,6 @@ require ( | |||||||
| github.com/spf13/afero v1.1.2 // indirect | ||||||||
| github.com/spf13/jwalterweatherman v1.0.0 // indirect | ||||||||
| github.com/spf13/pflag v1.0.6 // indirect | ||||||||
|
||||||||
| github.com/spf13/pflag v1.0.6 // indirect | |
| github.com/spf13/pflag v1.0.6 // indirect | |
| golang.org/x/crypto v0.31.0 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change won’t actually make
calculateAmountrespect the global--timeoutvalue, becausecalculateAmountwraps the provided context with its own hard-coded2*time.Secondtimeout. As a result, the operation can still time out at 2s even ifrootContexthas a larger deadline (and the previous 5s wrapper didn’t matter either). Consider removing the internal fixed timeout or deriving it from the remaining time/deadline of the incoming context.