From 7c69e44b3589b66e4460cf6dd438504e1991e146 Mon Sep 17 00:00:00 2001 From: mirkoCrobu Date: Wed, 3 Dec 2025 10:54:10 +0100 Subject: [PATCH 1/2] update lib index during update --- internal/update/arduino/arduino.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/update/arduino/arduino.go b/internal/update/arduino/arduino.go index 0c4e5d29..4c92b8af 100644 --- a/internal/update/arduino/arduino.go +++ b/internal/update/arduino/arduino.go @@ -82,6 +82,15 @@ func (a *ArduinoPlatformUpdater) ListUpgradablePackages(ctx context.Context, _ f return nil, err } + streamLibIndex, _ := commands.UpdateLibrariesIndexStreamResponseToCallbackFunction(ctx, func(curr *rpc.DownloadProgress) { + slog.Debug("downloading library index", "progress", curr.GetMessage()) + }) + + req := &rpc.UpdateLibrariesIndexRequest{Instance: inst, UpdateIfOlderThanSecs: 0} + if err := srv.UpdateLibrariesIndex(req, streamLibIndex); err != nil { + slog.Warn("error updating library index, skipping", slog.String("error", err.Error())) + } + if err := srv.Init( &rpc.InitRequest{Instance: inst}, commands.InitStreamResponseToCallbackFunction(ctx, func(r *rpc.InitResponse) error { From e77f65cbaa07d2847b4e0a0964541d96a12fda6c Mon Sep 17 00:00:00 2001 From: Luca Rinaldi Date: Thu, 4 Dec 2025 16:30:52 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Davide --- internal/update/arduino/arduino.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/update/arduino/arduino.go b/internal/update/arduino/arduino.go index 4c92b8af..4958d002 100644 --- a/internal/update/arduino/arduino.go +++ b/internal/update/arduino/arduino.go @@ -86,7 +86,7 @@ func (a *ArduinoPlatformUpdater) ListUpgradablePackages(ctx context.Context, _ f slog.Debug("downloading library index", "progress", curr.GetMessage()) }) - req := &rpc.UpdateLibrariesIndexRequest{Instance: inst, UpdateIfOlderThanSecs: 0} + req := &rpc.UpdateLibrariesIndexRequest{Instance: inst} if err := srv.UpdateLibrariesIndex(req, streamLibIndex); err != nil { slog.Warn("error updating library index, skipping", slog.String("error", err.Error())) }