Skip to content

Commit

Permalink
block semaphore acquisition
Browse files Browse the repository at this point in the history
[goreleaser]
  • Loading branch information
trajan0x committed Jul 8, 2024
1 parent 2d8fd40 commit bd22f55
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
27 changes: 27 additions & 0 deletions ethergo/listener/otel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package listener

import (
"github.com/synapsecns/sanguine/core/metrics"
"go.opentelemetry.io/otel/metric"
)

const meterName = "github.com/synapsecns/sanguine/ethergo/listener"

Check failure on line 8 in ethergo/listener/otel.go

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

`meterName` is unused (deadcode)

// generate an interface for otelRecorder that exports the public method.
// this allows us to avoid using recordX externally anad makes the package less confusing.
//
// =============================================================================
// =============================================================================
// IMPORTANT: DO NOT REMOVE THIS COMMENT.
// NOTICE: PLEASE MAKE SURE YOU UPDATE BOTH THE DOCS AND THE GRAFANA DASHBOARD (IF NEEDED) AFTER UPDATING METRICS.
// =============================================================================
// =============================================================================
//
//go:generate go run github.com/vburenin/ifacemaker -f metrics.go -s otelRecorder -i iOtelRecorder -p submitter -o metrics_generated.go -c "autogenerated file"
type otelRecorder struct {

Check failure on line 21 in ethergo/listener/otel.go

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

`otelRecorder` is unused (deadcode)
metrics metrics.Handler

Check failure on line 22 in ethergo/listener/otel.go

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

`metrics` is unused (structcheck)
// meter is the metrics meter.
meter metric.Meter

Check failure on line 24 in ethergo/listener/otel.go

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

`meter` is unused (structcheck)
// confirmedQueueGauge is the gauge for the confirmed queue.
confirmedQueueGauge metric.Int64ObservableGauge

Check failure on line 26 in ethergo/listener/otel.go

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

`confirmedQueueGauge` is unused (structcheck)
}
8 changes: 1 addition & 7 deletions services/rfq/relayer/service/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,7 @@ func (r *Relayer) processDB(ctx context.Context, serial bool, matchStatuses ...r
} else {
// process in parallel (new goroutine)
request := req // capture func literal
ok := r.semaphore.TryAcquire(1)
if !ok {
span.AddEvent("could not acquire semaphore", trace.WithAttributes(
attribute.String("transaction_id", hexutil.Encode(request.TransactionID[:])),
))
continue
}
err = r.semaphore.Acquire(ctx, 1)
if err != nil {
return fmt.Errorf("could not acquire semaphore: %w", err)
}
Expand Down

0 comments on commit bd22f55

Please sign in to comment.