Skip to content

Commit

Permalink
Add git_command_timeout_s for allowing >20 seconds for git operations (
Browse files Browse the repository at this point in the history
…#1250)

* Add a new config value for git operation timeouts

* Apply suggestions from code review

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>

---------

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
  • Loading branch information
mdietz94 and fcollonval authored Aug 3, 2023
1 parent f12b82c commit a49a53a
Show file tree
Hide file tree
Showing 20 changed files with 829 additions and 143 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Once installed, extension behavior can be modified via the following settings wh
- `JupyterLabGit.credential_helper`: Git credential helper to set to cache the credentials.
The default value is `cache --timeout=3600` to cache the credentials for an hour. If you want to cache them for 10 hours, set `cache --timeout=36000`.
- `JupyterLabGit.excluded_paths`: Set path patterns to exclude from this extension. You can use wildcard and interrogation mark for respectively everything or any single character in the pattern.

- `JupyterLabGit.git_command_timeout_s`: Set the timeout for git operations. Defaults to 20 seconds.
<details>
<summary><b>How to set server settings?</b></summary>

Expand Down
11 changes: 10 additions & 1 deletion jupyterlab_git/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Initialize the backend server extension
"""
from traitlets import List, Dict, Unicode, default
from traitlets import CFloat, List, Dict, Unicode, default
from traitlets.config import Configurable

try:
Expand Down Expand Up @@ -46,10 +46,19 @@ class JupyterLabGit(Configurable):
config=True,
)

git_command_timeout = CFloat(
help="The timeout for executing git operations. By default it is set to 20 seconds.",
config=True,
)

@default("credential_helper")
def _credential_helper_default(self):
return "cache --timeout=3600"

@default("git_command_timeout")
def _git_command_timeout_default(self):
return 20.0


def _jupyter_server_extension_points():
return [{"module": "jupyterlab_git"}]
Expand Down
Loading

0 comments on commit a49a53a

Please sign in to comment.