Skip to content

Commit 81a9b68

Browse files
committed
minor bugs
1 parent 823f383 commit 81a9b68

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

frontend/app/view/processviewer/processviewer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ export class ProcessViewerViewModel implements ViewModel {
311311
this.cancelPoll = null;
312312
this.startKeepAlive();
313313
} else {
314+
if (this.cancelPoll) {
315+
this.cancelPoll();
316+
}
317+
this.cancelPoll = null;
314318
this.startPolling();
315319
}
316320
}

pkg/wshrpc/wshremote/processviewer.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ func (s *procCacheState) getWidgetPidOrder(widgetId string) ([]int32, int) {
160160
func (s *procCacheState) updateCacheAndCheckIdle(result *wshrpc.ProcessListResponse, firstDone *bool, firstReadyCh chan struct{}) bool {
161161
s.lock.Lock()
162162
defer s.lock.Unlock()
163-
s.cached = result
163+
if result != nil {
164+
s.cached = result
165+
}
164166
if !*firstDone {
165167
*firstDone = true
166168
close(firstReadyCh)
@@ -254,7 +256,10 @@ func (s *procCacheState) collectSnapshot(numCPU int) *wshrpc.ProcessListResponse
254256
s.lastCPUSamples = make(map[int32]cpuSample, len(procs))
255257
}
256258

257-
snap, _ := procinfo.MakeGlobalSnapshot()
259+
snap, err := procinfo.MakeGlobalSnapshot()
260+
if err != nil {
261+
return nil
262+
}
258263

259264
hasCPU := s.lastCPUEpoch > 1 // first epoch has no previous sample to diff against
260265

0 commit comments

Comments
 (0)