Polling api if down
This commit is contained in:
parent
09091ccae5
commit
4ae86f3284
2 changed files with 12 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { makeStyles, withStyles } from '@material-ui/core/styles';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
|
||||
import { Accordion, AccordionDetails, AccordionSummary } from '@material-ui/core';
|
||||
|
||||
|
@ -11,16 +11,10 @@ import IconButton from '@material-ui/core/IconButton';
|
|||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import FileCopyOutlined from '@material-ui/icons/FileCopyOutlined';
|
||||
|
||||
// import {ExpandMoreIcon, FileCopyOutlined} from '@material-ui/icons';
|
||||
|
||||
import OutputFormatSelection from './OutputFormatSelection'
|
||||
import OSSelector from './OSSelector'
|
||||
|
||||
|
||||
import { Radio, RadioGroup } from '@material-ui/core';
|
||||
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||
import FormControl from '@material-ui/core/FormControl';
|
||||
import FormLabel from '@material-ui/core/FormLabel';
|
||||
import OnlineConverter from "./OnlineConverter";
|
||||
|
||||
class ControlledAccordions extends React.Component {
|
||||
|
|
20
src/index.js
20
src/index.js
|
@ -12,8 +12,7 @@ import {
|
|||
GoogleReCaptcha,
|
||||
} from 'react-google-recaptcha-v3'
|
||||
|
||||
|
||||
WakeUp();
|
||||
WakeUp()
|
||||
|
||||
ReactGA.initialize('UA-174657678-1')
|
||||
ReactGA.pageview(window.location.pathname + window.location.search)
|
||||
|
@ -40,18 +39,21 @@ ReactDOM.render(
|
|||
document.getElementById('root'),
|
||||
)
|
||||
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
serviceWorker.unregister()
|
||||
|
||||
|
||||
async function WakeUp() {
|
||||
try{
|
||||
await fetch("https://api.audible-converter.ml/api/v2/WakeUpNeo")
|
||||
console.log("Woke up")
|
||||
}catch(ex){
|
||||
console.log("Error occured: "+ ex)
|
||||
while (true) {
|
||||
let timeout = 1000 * 10; // 10 seconds
|
||||
try {
|
||||
await fetch('https://api.audible-converter.ml/api/v2/WakeUpNeo')
|
||||
console.log('Woke up')
|
||||
} catch (ex) {
|
||||
console.log('Error occured: ' + ex)
|
||||
timeout = 500; // 0.5 seconds
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, timeout))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue