Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get number of shards from observers #463

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

sstanculeanu
Copy link
Contributor

No description provided.

@sstanculeanu sstanculeanu self-assigned this Sep 30, 2024
Comment on lines 411 to 431
httpClient := &http.Client{}
httpClient.Timeout = time.Duration(cfg.GeneralSettings.RequestTimeoutSec) * time.Second
observersList := make([]string, 0, len(cfg.Observers))
for _, node := range cfg.Observers {
observersList = append(observersList, node.Address)
}
argsNumShardsProcessor := process.ArgNumShardsProcessor{
HttpClient: httpClient,
Observers: observersList,
TimeBetweenNodesRequestsInSec: cfg.GeneralSettings.TimeBetweenNodesRequestsInSec,
NumShardsTimeoutInSec: cfg.GeneralSettings.NumShardsTimeoutInSec,
RequestTimeoutInSec: cfg.GeneralSettings.RequestTimeoutSec,
}
numShardsProcessor, err := process.NewNumShardsProcessor(argsNumShardsProcessor)
if err != nil {
return nil, err
}

ctx, cancel := context.WithCancel(context.Background())
numShards, err := numShardsProcessor.GetNetworkNumShards(ctx)
cancel()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can extract this into a separate func for getting the number of shards, since the component is created only for this usage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed

@sstanculeanu sstanculeanu merged commit c170a4c into rc/v1.7.next1 Oct 3, 2024
5 checks passed
@sstanculeanu sstanculeanu deleted the get_number_of_shards_from_observers branch October 3, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants