Skip to content

Commit

Permalink
Poll runs after page loaded (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingwl committed Apr 14, 2021
1 parent ca08488 commit 131a7e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions tb_plugin/fe/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,20 @@ export const App = () => {
})
}, [])

const waitForRuns = async () => {
while (true) {
try {
const runs = await api.defaultApi.runsGet()
setRuns(runs)
break
} catch (e) {
console.info('Cannot fetch runs: ', e)
}
}
}

React.useEffect(() => {
api.defaultApi.runsGet().then((runs) => {
setRuns(runs)
})
waitForRuns()
}, [])

React.useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion tb_plugin/torch_tb_profiler/static/index.html

Large diffs are not rendered by default.

0 comments on commit 131a7e2

Please sign in to comment.