diff options
| author | Kyren223 <kyren223@proton.me> | 2025-07-30 20:06:22 +0300 |
|---|---|---|
| committer | Kyren223 <kyren223@proton.me> | 2025-07-30 20:06:22 +0300 |
| commit | 77dc3bf32f2b0c651df8bdb2d7ddd0d6e34cef0e (patch) | |
| tree | 1d9990633ec8a8267ccfd0ec2091332cb99315a6 | |
| parent | fb8fba2265bd5229ec68da553587132af6c9521f (diff) | |
Fixed ci to pass, removed pyroscope
| -rw-r--r-- | cmd/server/main.go | 50 | ||||
| -rw-r--r-- | internal/server/api/api.go | 6 | ||||
| -rw-r--r-- | internal/server/server.go | 2 | ||||
| -rw-r--r-- | tools/test_rate_limit.go | 4 |
4 files changed, 33 insertions, 29 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go index 147670e..8ee5674 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -29,9 +29,9 @@ import ( "syscall" "time" - "github.com/grafana/pyroscope-go" - _ "github.com/grafana/pyroscope-go/godeltaprof/http/pprof" - _ "net/http/pprof" + // "github.com/grafana/pyroscope-go" + // _ "github.com/grafana/pyroscope-go/godeltaprof/http/pprof" + // _ "net/http/pprof" "github.com/kyren223/eko/embeds" "github.com/kyren223/eko/internal/server" @@ -73,7 +73,7 @@ func main() { handleReload() handleShutdown(cancel) - startPyroscopeProfiling() + // startPyroscopeProfiling() if ok := reloadTosAndPrivacy(); !ok { return @@ -226,24 +226,24 @@ func reloadTosAndPrivacy() bool { return true } -func startPyroscopeProfiling() { - pyroscope.Start(pyroscope.Config{ - ApplicationName: "eko", - ServerAddress: "http://localhost:4040", - Logger: pyroscope.StandardLogger, // nil to disable - // by default all profilers are enabled, - // but you can select the ones you want to use: - ProfileTypes: []pyroscope.ProfileType{ - pyroscope.ProfileCPU, - pyroscope.ProfileAllocObjects, - pyroscope.ProfileAllocSpace, - pyroscope.ProfileInuseObjects, - pyroscope.ProfileInuseSpace, - pyroscope.ProfileGoroutines, - pyroscope.ProfileMutexCount, - pyroscope.ProfileMutexCount, - pyroscope.ProfileBlockCount, - pyroscope.ProfileBlockDuration, - }, - }) -} +// func startPyroscopeProfiling() { +// pyroscope.Start(pyroscope.Config{ +// ApplicationName: "eko", +// ServerAddress: "http://localhost:4040", +// Logger: pyroscope.StandardLogger, // nil to disable +// // by default all profilers are enabled, +// // but you can select the ones you want to use: +// ProfileTypes: []pyroscope.ProfileType{ +// pyroscope.ProfileCPU, +// pyroscope.ProfileAllocObjects, +// pyroscope.ProfileAllocSpace, +// pyroscope.ProfileInuseObjects, +// pyroscope.ProfileInuseSpace, +// pyroscope.ProfileGoroutines, +// pyroscope.ProfileMutexCount, +// pyroscope.ProfileMutexCount, +// pyroscope.ProfileBlockCount, +// pyroscope.ProfileBlockDuration, +// }, +// }) +// } diff --git a/internal/server/api/api.go b/internal/server/api/api.go index 5f11070..604edd1 100644 --- a/internal/server/api/api.go +++ b/internal/server/api/api.go @@ -1728,13 +1728,17 @@ func DeviceAnalytics(ctx context.Context, sess *session.Session, request *packet sess.SetAnalytics(request) queries := data.New(db) - queries.SetDeviceAnalytics(ctx, data.SetDeviceAnalyticsParams{ + _, err := queries.SetDeviceAnalytics(ctx, data.SetDeviceAnalyticsParams{ DeviceID: request.DeviceID, Os: &request.OS, Arch: &request.Arch, Term: &request.Term, Colorterm: &request.Colorterm, }) + if err != nil { + slog.ErrorContext(ctx, "database error", "error", err) + return &ErrInternalError + } return nil } diff --git a/internal/server/server.go b/internal/server/server.go index 15c3a7a..1a538de 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -133,7 +133,7 @@ type server struct { } } -// Creates a new server on the given port. +// NewServer creates a new server on the given port. // Will generate a unique node ID automatically, will crash if there are no available IDs. func NewServer(ctx context.Context, port uint16) server { assert.Assert(nodeId <= snowflake.NodeMax, "maximum amount of servers reached") diff --git a/tools/test_rate_limit.go b/tools/test_rate_limit.go index 7c25d20..7cc81d0 100644 --- a/tools/test_rate_limit.go +++ b/tools/test_rate_limit.go @@ -11,7 +11,7 @@ import ( const addr = "localhost:7223" var tlsConfig = &tls.Config{ - InsecureSkipVerify: true, // skip cert verification + InsecureSkipVerify: true, // #nosec G402 skip cert verification } func connect(n int, label string) { @@ -27,7 +27,7 @@ func connect(n int, label string) { } time.Sleep(300 * time.Millisecond) for _, c := range conns { - c.Close() + _ = c.Close() } time.Sleep(200 * time.Millisecond) } |
