mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
insights: add site configuration value for commit indexer interval (#25312)
This commit is contained in:
parent
6d2d8175c5
commit
452cce8207
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
|
||||
@ -84,8 +85,11 @@ func NewCommitIndexerWorker(ctx context.Context, base dbutil.DB, insights dbutil
|
||||
}
|
||||
|
||||
func (i *CommitIndexer) Handler(ctx context.Context, observationContext *observation.Context) goroutine.BackgroundRoutine {
|
||||
//TODO(insights) consider adding setting for index interval
|
||||
interval := time.Hour * 1
|
||||
intervalMinutes := conf.Get().InsightsCommitIndexerInterval
|
||||
if intervalMinutes <= 0 {
|
||||
intervalMinutes = 60
|
||||
}
|
||||
interval := time.Minute * time.Duration(intervalMinutes)
|
||||
|
||||
return goroutine.NewPeriodicGoroutineWithMetrics(ctx, interval,
|
||||
goroutine.NewHandlerWithErrorMessage("commit_indexer_handler", func(ctx context.Context) error {
|
||||
|
||||
@ -58,6 +58,7 @@ var requireRestart = []string{
|
||||
"externalURL",
|
||||
"update.channel",
|
||||
"insights.query.worker.concurrency",
|
||||
"insights.commit.indexer.interval",
|
||||
}
|
||||
|
||||
// NeedRestartToApply determines if a restart is needed to apply the changes
|
||||
|
||||
@ -1536,6 +1536,8 @@ type SiteConfiguration struct {
|
||||
HtmlHeadBottom string `json:"htmlHeadBottom,omitempty"`
|
||||
// HtmlHeadTop description: HTML to inject at the top of the `<head>` element on each page, for analytics scripts
|
||||
HtmlHeadTop string `json:"htmlHeadTop,omitempty"`
|
||||
// InsightsCommitIndexerInterval description: The interval (in minutes) at which the insights commit indexer will check for new commits.
|
||||
InsightsCommitIndexerInterval int `json:"insights.commit.indexer.interval,omitempty"`
|
||||
// InsightsHistoricalFrameLength description: (debug) duration of historical insights timeframes, one point per repository will be recorded in each timeframe.
|
||||
InsightsHistoricalFrameLength string `json:"insights.historical.frameLength,omitempty"`
|
||||
// InsightsHistoricalFrames description: (debug) number of historical insights timeframes to populate
|
||||
|
||||
@ -908,6 +908,13 @@
|
||||
"examples": [50.0, 0.5],
|
||||
"!go": { "pointer": true }
|
||||
},
|
||||
"insights.commit.indexer.interval": {
|
||||
"description": "The interval (in minutes) at which the insights commit indexer will check for new commits.",
|
||||
"type": "integer",
|
||||
"group": "CodeInsights",
|
||||
"default": 60,
|
||||
"examples": [120]
|
||||
},
|
||||
"htmlHeadTop": {
|
||||
"description": "HTML to inject at the top of the `<head>` element on each page, for analytics scripts",
|
||||
"type": "string",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user