mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:31:54 +00:00
Disable services that are causing issues on Windows. (#54263)
(temporarily) Disable the following services on Windows: 1. Periodic 'echo' metric 2. Janitor: Periodic cleans up repositories. Also move license.rtf to text format (instead of binary.) ## Test plan - Non-windows systems: no functional change - Manually install and run Cody
This commit is contained in:
parent
af3b8ed38c
commit
9f598abc55
@ -17,6 +17,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -499,6 +500,12 @@ func (s *Server) Handler() http.Handler {
|
||||
// Janitor does clean up tasks over s.ReposDir and is expected to run in a
|
||||
// background goroutine.
|
||||
func (s *Server) Janitor(ctx context.Context, interval time.Duration) {
|
||||
if runtime.GOOS == "windows" {
|
||||
// See https://github.com/sourcegraph/sourcegraph/issues/54317 for details.
|
||||
s.Logger.Warn("Janitor is disabled")
|
||||
return
|
||||
}
|
||||
|
||||
for {
|
||||
gitserverAddrs := gitserver.NewGitserverAddressesFromConf(conf.Get())
|
||||
s.cleanupRepos(actor.WithInternalActor(ctx), gitserverAddrs)
|
||||
|
||||
@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
@ -18,24 +19,30 @@ import (
|
||||
)
|
||||
|
||||
func (s *Server) RegisterMetrics(observationCtx *observation.Context, db dbutil.DB) {
|
||||
// test the latency of exec, which may increase under certain memory
|
||||
// conditions
|
||||
echoDuration := prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "src_gitserver_echo_duration_seconds",
|
||||
Help: "Duration of executing the echo command.",
|
||||
})
|
||||
prometheus.MustRegister(echoDuration)
|
||||
go func(server *Server) {
|
||||
for {
|
||||
time.Sleep(10 * time.Second)
|
||||
s := time.Now()
|
||||
if err := exec.Command("echo").Run(); err != nil {
|
||||
server.Logger.Warn("exec measurement failed", log.Error(err))
|
||||
continue
|
||||
if runtime.GOOS != "windows" {
|
||||
s.Logger.Info("Enabling 'echo' metric")
|
||||
// test the latency of exec, which may increase under certain memory
|
||||
// conditions
|
||||
echoDuration := prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "src_gitserver_echo_duration_seconds",
|
||||
Help: "Duration of executing the echo command.",
|
||||
})
|
||||
prometheus.MustRegister(echoDuration)
|
||||
go func(server *Server) {
|
||||
for {
|
||||
time.Sleep(10 * time.Second)
|
||||
s := time.Now()
|
||||
if err := exec.Command("echo").Run(); err != nil {
|
||||
server.Logger.Warn("exec measurement failed", log.Error(err))
|
||||
continue
|
||||
}
|
||||
echoDuration.Set(time.Since(s).Seconds())
|
||||
}
|
||||
echoDuration.Set(time.Since(s).Seconds())
|
||||
}
|
||||
}(s)
|
||||
}(s)
|
||||
} else {
|
||||
// See https://github.com/sourcegraph/sourcegraph/issues/54317 for details.
|
||||
s.Logger.Warn("Disabling 'echo' metric")
|
||||
}
|
||||
|
||||
// report the size of the repos dir
|
||||
if s.ReposDir == "" {
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
|
||||
{\colortbl ;\red0\green0\blue255;}
|
||||
{\*\generator Riched20 10.0.22621}\viewkind4\uc1
|
||||
\pard\sa200\sl276\slmult1\b\f0\fs28\lang9 Usage and Privacy Notice\fs22\par
|
||||
{\b0{\field{\*\fldinst{HYPERLINK https://about.sourcegraph.com/terms/cody-notice }}{\fldrslt{https://about.sourcegraph.com/terms/cody-notice\ul0\cf0}}}}\b0\f0\fs22\par
|
||||
\par
|
||||
\b\fs28 Terms of Service for Sourcegraph Cloud\b0\fs22\par
|
||||
{{\field{\*\fldinst{HYPERLINK https://about.sourcegraph.com/terms/cloud }}{\fldrslt{https://about.sourcegraph.com/terms/cloud\ul0\cf0}}}}\f0\fs22\par
|
||||
}
|
||||
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
|
||||
{\colortbl ;\red0\green0\blue255;}
|
||||
{\*\generator Riched20 10.0.22621}\viewkind4\uc1
|
||||
\pard\sa200\sl276\slmult1\b\f0\fs28\lang9 Usage and Privacy Notice\fs22\par
|
||||
{\b0{\field{\*\fldinst{HYPERLINK https://about.sourcegraph.com/terms/cody-notice }}{\fldrslt{https://about.sourcegraph.com/terms/cody-notice\ul0\cf0}}}}\b0\f0\fs22\par
|
||||
\par
|
||||
\b\fs28 Terms of Service for Sourcegraph Cloud\b0\fs22\par
|
||||
{{\field{\*\fldinst{HYPERLINK https://about.sourcegraph.com/terms/cloud }}{\fldrslt{https://about.sourcegraph.com/terms/cloud\ul0\cf0}}}}\f0\fs22\par}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user