Skip to content

Commit

Permalink
Fix cpu usage spike in some pages caused by an infinite loop (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
beansgum committed Aug 19, 2021
1 parent 8652943 commit 75810ad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
6 changes: 2 additions & 4 deletions ui/page/overview_page.go
Expand Up @@ -613,10 +613,8 @@ func (pg *OverviewPage) listenForSyncNotifications() {

select {
case notification = <-pg.Receiver.NotificationsUpdate:
default:
if components.ContextDone(pg.ctx) {
return
}
case <-pg.ctx.Done():
return
}

switch n := notification.(type) {
Expand Down
6 changes: 2 additions & 4 deletions ui/page/proposal/proposal_details_page.go
Expand Up @@ -125,10 +125,8 @@ func (pg *proposalDetails) listenForSyncNotifications() {

select {
case notification = <-pg.Receiver.NotificationsUpdate:
default:
if components.ContextDone(pg.ctx) {
return
}
case <-pg.ctx.Done():
return
}

switch n := notification.(type) {
Expand Down
6 changes: 2 additions & 4 deletions ui/page/proposal/proposals_page.go
Expand Up @@ -199,10 +199,8 @@ func (pg *ProposalsPage) listenForSyncNotifications() {

select {
case notification = <-pg.Receiver.NotificationsUpdate:
default:
if components.ContextDone(pg.ctx) {
return
}
case <-pg.ctx.Done():
return
}

switch n := notification.(type) {
Expand Down
6 changes: 2 additions & 4 deletions ui/page/transactions_page.go
Expand Up @@ -194,10 +194,8 @@ func (pg *TransactionsPage) listenForTxNotifications() {

select {
case notification = <-pg.Receiver.NotificationsUpdate:
default:
if components.ContextDone(pg.ctx) {
return
}
case <-pg.ctx.Done():
return
}

switch n := notification.(type) {
Expand Down

0 comments on commit 75810ad

Please sign in to comment.