Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

settings: add network.connection_timeout and network.cloud_api.skip_board_detection_calls #2770

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added gRPC flag to ignore Cloud API detection in BoardList* operations
  • Loading branch information
cmaglie committed Dec 10, 2024
commit 88e37717cc11c5252ca431044d79875c77681291
8 changes: 4 additions & 4 deletions 8 commands/service_board_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func identifyViaCloudAPI(props *properties.Map, settings *configuration.Settings
}

// identify returns a list of boards checking first the installed platforms or the Cloud API
func identify(pme *packagemanager.Explorer, port *discovery.Port, settings *configuration.Settings) ([]*rpc.BoardListItem, error) {
func identify(pme *packagemanager.Explorer, port *discovery.Port, settings *configuration.Settings, skipCloudAPI bool) ([]*rpc.BoardListItem, error) {
boards := []*rpc.BoardListItem{}
if port.Properties == nil {
return boards, nil
Expand Down Expand Up @@ -170,7 +170,7 @@ func identify(pme *packagemanager.Explorer, port *discovery.Port, settings *conf

// if installed cores didn't recognize the board, try querying
// the builder API if the board is a USB device port
if len(boards) == 0 {
if len(boards) == 0 && !skipCloudAPI {
items, err := identifyViaCloudAPI(port.Properties, settings)
if err != nil {
// this is bad, but keep going
Expand Down Expand Up @@ -225,7 +225,7 @@ func (s *arduinoCoreServerImpl) BoardList(ctx context.Context, req *rpc.BoardLis

ports := []*rpc.DetectedPort{}
for _, port := range dm.List() {
boards, err := identify(pme, port, s.settings)
boards, err := identify(pme, port, s.settings, req.GetSkipCloudApiForBoardDetection())
if err != nil {
warnings = append(warnings, err.Error())
}
Expand Down Expand Up @@ -298,7 +298,7 @@ func (s *arduinoCoreServerImpl) BoardListWatch(req *rpc.BoardListWatchRequest, s

boardsError := ""
if event.Type == "add" {
boards, err := identify(pme, event.Port, s.settings)
boards, err := identify(pme, event.Port, s.settings, req.GetSkipCloudApiForBoardDetection())
if err != nil {
boardsError = err.Error()
}
Expand Down
2 changes: 1 addition & 1 deletion 2 commands/service_board_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestBoardIdentifySorting(t *testing.T) {
defer release()

settings := configuration.NewSettings()
res, err := identify(pme, &discovery.Port{Properties: idPrefs}, settings)
res, err := identify(pme, &discovery.Port{Properties: idPrefs}, settings, true)
require.NoError(t, err)
require.NotNil(t, res)
require.Len(t, res, 4)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.