-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Disable auto reload if page is not visible in ng_tensorboard #3498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| constructor(private store: Store<State>) {} | ||
| constructor( | ||
| private store: Store<State>, | ||
| @Inject(DOCUMENT) private document: Document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private readonly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* document is readonly property in ReloaderComponent * fakeDocument is created for each test run
stephanwlee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM.
| declarations: [ReloaderComponent], | ||
| }).compileComponents(); | ||
| store = TestBed.get(Store); | ||
| fakeDocument = TestBed.get(DOCUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering, what happens if you change this to TestBed.get(DOCUMENT) as typeof document?
I want to avoid any where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof document doesn't seem to help. I can (and have) made fakeDocument: Document but it requires some slight grossness to override the visibilityState property. That's ok - I think the grossness is outweighed by the better typing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acknowledged.
…low#3498) Note that this is the ng_tensorboard version of tensorflow#3483. * Motivation for features / changes Reduce the load on TensorBoard servers by disabling auto reload if the page is not considered visible. * Technical description of changes Do not auto reload if document is not visible according to the Page Visibility API. When page again becomes visible perform an auto reload if one has been missed.
Note that this is the ng_tensorboard version of #3483. * Motivation for features / changes Reduce the load on TensorBoard servers by disabling auto reload if the page is not considered visible. * Technical description of changes Do not auto reload if document is not visible according to the Page Visibility API. When page again becomes visible perform an auto reload if one has been missed.
Note that this is the ng_tensorboard version of #3483.
Motivation for features / changes
Reduce the load on TensorBoard servers by disabling auto reload if the page is not considered visible.
Technical description of changes
Do not auto reload if document is not visible according to the Page
Visibility API. When page again becomes visible perform an auto reload
if one has been missed.
Detailed steps to verify changes work correctly (as executed by you)
Run a local TensorBoard.
Open localhost:6006.
Ensure option "Reload data" is selected and choose a 15s "Reload Period".
Open detached network tab in chrome developer tools.
Watch for several minutes and observe that many network calls are made every 15s.
Open different tab in same window but with chrome developer tools still visible.
Watch for several minutes and observe that no network calls are made.
Switch back to TensorBoard tab and watch as network calls are immediately made and UI reloads graphs.
Continue to watch network tab as it again follows a 15s period for reload network calls.