Skip to content

Commit

Permalink
Merge pull request #174 from overmindtech/deadlines
Browse files Browse the repository at this point in the history
Update sdp-go (remove timeouts)
  • Loading branch information
DavidS-ovm authored Sep 13, 2023
2 parents 342a796 + 4055b7e commit 367ef27
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions enginerequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ func (e *Engine) ExecuteQuery(ctx context.Context, query *sdp.Query, items chan<
// as `executionPool.Go()` will block once the max parallelism is hit
go func() {
// queue everything into the execution pool
defer LogRecoverToReturn(&ctx, "ExecuteQuery outer")
defer LogRecoverToReturn(ctx, "ExecuteQuery outer")
e.executionPool.Go(func() {
defer LogRecoverToReturn(&ctx, "ExecuteQuery inner")
defer LogRecoverToReturn(ctx, "ExecuteQuery inner")
defer wg.Done()
var queryItems []*sdp.Item
var queryErrors []*sdp.QueryError
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
github.com/nats-io/nats-server/v2 v2.9.22
github.com/nats-io/nats.go v1.28.0
github.com/overmindtech/sdp-go v0.48.2
github.com/overmindtech/sdp-go v0.49.0
github.com/overmindtech/sdpcache v1.5.0
github.com/sirupsen/logrus v1.9.3
github.com/sourcegraph/conc v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/overmindtech/api-client v0.14.0 h1:zXyjJsIeawNqoWv7FqOjwcqgFpLrDYz7l9MWqh1G9ZQ=
github.com/overmindtech/api-client v0.14.0/go.mod h1:msdkTAQFlvDGOU4tQk2adk2P8j23uaMWkJ9YRX4wGWI=
github.com/overmindtech/sdp-go v0.48.2 h1:iSo/yqj/oy4kRFjtszMOFrVBHHalBFb6oQz7TOXVNSY=
github.com/overmindtech/sdp-go v0.48.2/go.mod h1:Eg/OSql8z1N7kZej0i0AHYMoApMJHmjMBE2gWUsTsN8=
github.com/overmindtech/sdp-go v0.49.0 h1:m2NoNdodPM5xrcfaBP+Df67JCmEbWcwh60SWq2joiWQ=
github.com/overmindtech/sdp-go v0.49.0/go.mod h1:Eg/OSql8z1N7kZej0i0AHYMoApMJHmjMBE2gWUsTsN8=
github.com/overmindtech/sdpcache v1.5.0 h1:QzHWQm1KGN9rNHPb/VZvz7WDCsyKOuVLlNUGF2CIFGc=
github.com/overmindtech/sdpcache v1.5.0/go.mod h1:GFMMle860EWMDQXbk6dhLVSQrV0YlEqqJ6/VNxINb0o=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
Expand Down
4 changes: 2 additions & 2 deletions querytracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (qt *QueryTracker) linkItem(ctx context.Context, parent *sdp.Item, followOn
var shouldRemove bool

go func(e chan error) {
defer LogRecoverToReturn(&ctx, "linkItem -> ExecuteQuery")
defer LogRecoverToReturn(ctx, "linkItem -> ExecuteQuery")
e <- qt.Engine.ExecuteQuery(ctx, req.Query, items, errs)
}(queryErr)

Expand Down Expand Up @@ -285,7 +285,7 @@ func (qt *QueryTracker) Execute(ctx context.Context) ([]*sdp.Item, []*sdp.QueryE

// Run the query
go func(e chan error) {
defer LogRecoverToReturn(&ctx, "Execute -> ExecuteQuery")
defer LogRecoverToReturn(ctx, "Execute -> ExecuteQuery")
e <- qt.Engine.ExecuteQuery(ctx, qt.Query, items, errs)
}(errChan)

Expand Down
8 changes: 4 additions & 4 deletions tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (

// LogRecoverToReturn Recovers from a panic, logs and forwards it sentry and otel, then returns
// Does nothing when there is no panic.
func LogRecoverToReturn(ctx *context.Context, loc string) {
func LogRecoverToReturn(ctx context.Context, loc string) {
err := recover()
if err == nil {
return
Expand All @@ -41,7 +41,7 @@ func LogRecoverToReturn(ctx *context.Context, loc string) {

// LogRecoverToExit Recovers from a panic, logs and forwards it sentry and otel, then exits
// Does nothing when there is no panic.
func LogRecoverToExit(ctx *context.Context, loc string) {
func LogRecoverToExit(ctx context.Context, loc string) {
err := recover()
if err == nil {
return
Expand All @@ -53,15 +53,15 @@ func LogRecoverToExit(ctx *context.Context, loc string) {
os.Exit(1)
}

func handleError(ctx *context.Context, loc string, err interface{}, stack string) {
func handleError(ctx context.Context, loc string, err interface{}, stack string) {
msg := fmt.Sprintf("unhandled panic in %v, exiting: %v", loc, err)

sentry.CurrentHub().Recover(err)

log.WithFields(log.Fields{"loc": loc, "stack": stack}).Error(msg)

if ctx != nil {
span := trace.SpanFromContext(*ctx)
span := trace.SpanFromContext(ctx)
span.SetAttributes(attribute.String("om.panic.loc", loc))
span.SetAttributes(attribute.String("om.panic.stack", stack))
}
Expand Down

0 comments on commit 367ef27

Please sign in to comment.