auto-retry for some forecast data
This commit is contained in:
parent
76fd93e6e1
commit
5dd8f4bd62
16 changed files with 101 additions and 36 deletions
|
|
@ -33,7 +33,7 @@ class Hourly extends WeatherDisplay {
|
|||
let forecast;
|
||||
try {
|
||||
// get the forecast
|
||||
forecast = await json(weatherParameters.forecastGridData);
|
||||
forecast = await json(weatherParameters.forecastGridData, { retryCount: 3, stillWaiting: () => this.stillWaiting() });
|
||||
} catch (e) {
|
||||
console.error('Get hourly forecast failed');
|
||||
console.error(e.status, e.responseJSON);
|
||||
|
|
@ -120,7 +120,8 @@ class Hourly extends WeatherDisplay {
|
|||
|
||||
// make data available outside this class
|
||||
// promise allows for data to be requested before it is available
|
||||
async getCurrentData() {
|
||||
async getCurrentData(stillWaiting) {
|
||||
if (stillWaiting) this.stillWaitingCallbacks.push(stillWaiting);
|
||||
return new Promise((resolve) => {
|
||||
if (this.data) resolve(this.data);
|
||||
// data not available, put it into the data callback queue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue