Skip to content

Commit 8207199

Browse files
committed
foratting + mistake with windows handler
1 parent 201310a commit 8207199

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

rest/server_context.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"net"
2121
"net/http"
2222
"os"
23-
"os/signal"
2423
"path/filepath"
2524
"runtime"
2625
"slices"
@@ -29,7 +28,6 @@ import (
2928
"strings"
3029
"sync"
3130
"sync/atomic"
32-
"syscall"
3331
"time"
3432

3533
"github.com/KimMachineGun/automemlimit/memlimit"

rest/stack_trace_handler_windows.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,5 @@ package rest
1616
// registerSignalHandlerForStackTrace will register a signal handler to capture stack traces
1717
// - SIGUSR1 causes Sync Gateway to record a stack trace of all running goroutines.
1818
func (sc *ServerContext) registerSignalHandlerForStackTrace(ctx context.Context) {
19-
signalChannel := make(chan os.Signal, 1)
20-
signal.Notify(signalChannel, syscall.SIGUSR1)
21-
22-
defer func() {
23-
signal.Stop(signalChannel)
24-
close(signalChannel)
25-
}()
26-
27-
go func() {
28-
select {
29-
case sig := <-signalChannel:
30-
base.InfofCtx(ctx, base.KeyAll, "Handling signal: %v", sig)
31-
switch sig {
32-
case syscall.SIGUSR1:
33-
// stack trace signal received
34-
currentTime := time.Now()
35-
timestamp := currentTime.Format(time.RFC3339)
36-
sc.logStackTraces(ctx, timestamp)
37-
default:
38-
// unhandled signal here
39-
}
40-
case <-ctx.Done():
41-
return
42-
}
43-
}()
19+
// No-op on Windows
4420
}

0 commit comments

Comments
 (0)