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

Commit faa6359

Browse filesBrowse files
authored
fix: Ensure calls to BoardListWatch gRPC correctly release resources (#2681)
1 parent 43598fc commit faa6359
Copy full SHA for faa6359

File tree

1 file changed

+3
-7
lines changed
Filter options

1 file changed

+3
-7
lines changed

‎commands/service_board_list.go

Copy file name to clipboardExpand all lines: commands/service_board_list.go
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,14 @@ func (s *arduinoCoreServerImpl) BoardListWatch(req *rpc.BoardListWatchRequest, s
282282
if err != nil {
283283
return err
284284
}
285-
defer release()
286285
dm := pme.DiscoveryManager()
287286

288287
watcher, err := dm.Watch()
288+
release()
289289
if err != nil {
290290
return err
291291
}
292292

293-
go func() {
294-
<-stream.Context().Done()
295-
logrus.Trace("closed watch")
296-
watcher.Close()
297-
}()
298-
299293
go func() {
300294
for event := range watcher.Feed() {
301295
port := &rpc.DetectedPort{
@@ -319,5 +313,7 @@ func (s *arduinoCoreServerImpl) BoardListWatch(req *rpc.BoardListWatchRequest, s
319313
}()
320314

321315
<-stream.Context().Done()
316+
logrus.Trace("closed watch")
317+
watcher.Close()
322318
return nil
323319
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.