-
Notifications
You must be signed in to change notification settings - Fork 94
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
Debug: make indexing timeout configurable #676
Changes from 1 commit
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 |
---|---|---|
|
@@ -25,9 +25,7 @@ import ( | |
sglog "github.com/sourcegraph/log" | ||
) | ||
|
||
// indexTimeout defines how long the indexserver waits before | ||
// killing an indexing job. | ||
const indexTimeout = 1*time.Hour + 30*time.Minute // an index should never take longer than an hour and a half | ||
const defaultIndexingTimeout = 1*time.Hour + 30*time.Minute | ||
|
||
// IndexOptions are the options that Sourcegraph can set via it's search | ||
// configuration endpoint. | ||
|
@@ -183,7 +181,13 @@ func gitIndex(c gitIndexConfig, o *indexArgs, sourcegraph Sourcegraph, l sglog.L | |
|
||
buildOptions := o.BuildOptions() | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), indexTimeout) | ||
// indexingTimeout defines how long the indexserver waits before killing an indexing job. | ||
indexingTimeout := getEnvWithDefaultDuration("INDEXING_TIMEOUT", defaultIndexingTimeout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very minor: I think prefixing the envvar with something can help when reading configuration files. I see we have lost our consistency here, but will still have a lot of envvars prefixed with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we make this part of indexArgs and set it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We chatted about this over video, @stefanhengl is okay with an environment variable since we want to be able to change it without bouncing the server. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took a closer look at this, and decided to go with your suggestion, to match what we do for other debugging options like |
||
if indexingTimeout != defaultIndexingTimeout { | ||
debug.Printf("using configured indexing timeout: %s", indexingTimeout) | ||
} | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), indexingTimeout) | ||
defer cancel() | ||
|
||
gitDir, err := tmpGitDir(o.Name) | ||
|
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.
minor: you don't need the \n with the log pkg.