Skip to content

Fix bug where later causes 100% CPU in R from terminal#76

Merged
jcheng5 merged 6 commits intomasterfrom
joe/bugfix/100pct-cpu
Dec 10, 2018
Merged

Fix bug where later causes 100% CPU in R from terminal#76
jcheng5 merged 6 commits intomasterfrom
joe/bugfix/100pct-cpu

Conversation

@jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Nov 16, 2018

Fixes #74

Testing notes

See the repro example in #74, and also rstudio/websocket#34. It must be tested on Mac and Linux; Windows is not affected.

@jcheng5
Copy link
Member Author

jcheng5 commented Nov 16, 2018

Switch *callbackRegistry. to callbackRegistry->

Copy link
Member

@wch wch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: Replace *callbackRegistry.nextTimestamp() with callbackRegistry->nextTimestamp() to make it a bit more obvious what's going on.

@jcheng5
Copy link
Member Author

jcheng5 commented Nov 16, 2018

@wch It turns out callbackRegistry is not a pointer, but rather, nextTimestamp() returns an Optional<Timestamp> which you dereference to get the actual Timestamp value. I've pushed a commit to make this a little more obvious.

@wch
Copy link
Member

wch commented Nov 21, 2018

FWIW, with boost::optional, I find it clearer to use callbackRegistry.nextTimestamp().get() instead of *(callbackRegistry.nextTimestamp()), precisely because of the confusion we're having here. (We're using the local Optional class instead of boost::optional, though.)

@jcheng5 jcheng5 merged commit 2fb214b into master Dec 10, 2018
@jcheng5 jcheng5 deleted the joe/bugfix/100pct-cpu branch December 10, 2018 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants