-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Managed Transport for libgit2
libgit2 network operations are blocking and do not provide timeout nor context capabilities, leading for several reports by users of the controllers hanging indefinitely. By using managed transport, golang primitives such as http.Transport and net.Dial can be used to ensure timeouts are enforced. Co-Authored-by: Sunny <darkowlzz@protonmail.com> Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
- Loading branch information
Showing
8 changed files
with
753 additions
and
1 deletion.
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,18 @@ | ||
package managed | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
) | ||
|
||
// Enabled defines whether the use of Managed Transport should be enabled. | ||
// This is only affects git operations that uses libgit2 implementation. | ||
// | ||
// True is returned when the environment variable `EXPERIMENTAL_GIT_TRANSPORT` | ||
// is detected with the value of `true` or `1`. | ||
func Enabled() bool { | ||
if v, ok := os.LookupEnv("EXPERIMENTAL_GIT_TRANSPORT"); ok { | ||
return strings.ToLower(v) == "true" || v == "1" | ||
} | ||
return false | ||
} |
Oops, something went wrong.