Skip to content

Commit

Permalink
Exponentially backoff Jupyter support checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ppsreejith committed Nov 17, 2024
1 parent 8cd89a9 commit 66804bb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/src/jupyter/appState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class JupyterState extends DefaultAppState<JupyterNotebookState> {
initialInternalState = jupyterInternalState
actionController = new JupyterController(this)

public async setup() {
public async setup(retryNo = 1) {
// Subscribe & update internal state
// for jupyter version checking, just do a getState once here and see if it
// errors out. kind of hacky
Expand All @@ -31,9 +31,12 @@ export class JupyterState extends DefaultAppState<JupyterNotebookState> {
reason: "Please upgrade to Jupyter Notebook v7.0+ or JupyterLab v4.0+ to use MinusX",
},
});
if (retryNo > 5) {
return
}
setTimeout(() => {
this.setup()
}, 1000)
this.setup(retryNo + 1)
}, Math.pow(2, retryNo) * 1000) // Implement exponential backoff to check Jupyter status
}
}
public async getState() {
Expand Down

0 comments on commit 66804bb

Please sign in to comment.