Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/cometbft/co…
Browse files Browse the repository at this point in the history
…metbft-0.38.13
  • Loading branch information
aljo242 authored Nov 4, 2024
2 parents d13bd48 + c5b2cfc commit b33d5e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

# Primary repo maintainers

* @aljo242 @Eric-Warehime @technicallyty @wesl-ee @zrbecker
* @skip-mev/skip-connect
4 changes: 2 additions & 2 deletions cmd/connect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import (

var (
rootCmd = &cobra.Command{
Use: "oracle",
Short: "Run the connect oracle server.",
Use: "connect",
Short: "Run the connect oracle.",
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
return runOracle()
Expand Down
26 changes: 2 additions & 24 deletions providers/base/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"go.uber.org/zap"

"github.com/skip-mev/connect/v2/pkg/slices"
providermetrics "github.com/skip-mev/connect/v2/providers/base/metrics"
providertypes "github.com/skip-mev/connect/v2/providers/types"
)
Expand Down Expand Up @@ -85,23 +86,8 @@ func (p *Provider[K, V]) startMultiplexWebsocket(ctx context.Context) error {
if maxSubsPerConn > 0 {
// case where we will split ID's across sub handlers
numSubHandlers := int(math.Ceil(float64(len(ids)) / float64(maxSubsPerConn)))
p.logger.Debug("setting number of web socket handlers for provider", zap.Int("sub_handlers", numSubHandlers))
wg.SetLimit(numSubHandlers)

// split ids
for i := 0; i < numSubHandlers; i++ {
start := i * maxSubsPerConn

// Copy the IDs over.
subIDs := make([]K, 0)
if end := start + maxSubsPerConn; end >= len(ids) {
subIDs = append(subIDs, ids[start:]...)
} else {
subIDs = append(subIDs, ids[start:end]...)
}

subTasks = append(subTasks, subIDs)
}
subTasks = slices.Chunk(ids, maxSubsPerConn)
} else {
// case where there is 1 sub handler
subTasks = append(subTasks, ids)
Expand All @@ -110,14 +96,6 @@ func (p *Provider[K, V]) startMultiplexWebsocket(ctx context.Context) error {

for _, subIDs := range subTasks {
wg.Go(p.startWebSocket(ctx, subIDs))

select {
case <-time.After(p.wsCfg.HandshakeTimeout):
p.logger.Debug("handshake timeout reached")
case <-ctx.Done():
p.logger.Debug("context done")
return wg.Wait()
}
}

// Wait for all the sub handlers to finish.
Expand Down

0 comments on commit b33d5e3

Please sign in to comment.