Don't use Sentry's middleware

This commit is contained in:
David Robertson 2023-04-04 17:36:21 +01:00
parent d1260ab268
commit faef68bc6f
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
2 changed files with 2 additions and 10 deletions

View File

@ -3,7 +3,6 @@ package main
import (
"fmt"
"github.com/getsentry/sentry-go"
sentryhttp "github.com/getsentry/sentry-go/http"
syncv3 "github.com/matrix-org/sliding-sync"
"github.com/matrix-org/sliding-sync/internal"
"github.com/matrix-org/sliding-sync/sync2"
@ -13,7 +12,6 @@ import (
_ "net/http/pprof"
"os"
"strings"
"time"
)
var GitCommit string
@ -134,14 +132,6 @@ func main() {
h3 = otelhttp.NewHandler(h3, "Sync")
}
if args[EnvSentryDsn] != "" {
defer sentry.Flush(2 * time.Second)
sentryHandler := sentryhttp.New(sentryhttp.Options{
Repanic: true,
})
h3 = sentryHandler.Handle(h3)
}
syncv3.RunSyncV3Server(h3, args[EnvBindAddr], args[EnvServer], args[EnvTLSCert], args[EnvTLSKey])
select {} // block forever
}

View File

@ -3,6 +3,7 @@ package sync3
import (
"context"
"fmt"
"github.com/getsentry/sentry-go"
"runtime/debug"
"sync"
@ -83,6 +84,7 @@ func (c *Conn) tryRequest(ctx context.Context, req *Request) (res *Response, err
if panicErr != nil {
err = fmt.Errorf("panic: %s", panicErr)
logger.Error().Msg(string(debug.Stack()))
sentry.GetHubFromContext(ctx).RecoverWithContext(ctx, panicErr)
}
}()
taskType := "OnIncomingRequest"