Tengo una función simple que obtiene algunos datos, se los muestra al usuario (en un gráfico), espera 10 minutos y comienza de nuevo. Después de un tiempo, aparece este error Error: timeout of 0ms exceeded
Descubrí que se suponía que esto sucedería si no se puede conectar a Internet, lo cual no puede ser el caso.
¿Chrome está haciendo esto tal vez? Creo que podría congelar la aplicación o algo así.
Aquí está la función simple:
updateReports() { // checks for new data, waits the given time, and checks again.. forever this.$VKS.Read('Report', { filter: { shared: this.user }}) .then(reports => { this.reports = reports // show the data to the user setTimeout(() => { this.updateReports() // start again }, 1000 * 60 * 10) // 10 minutes }).catch(err => console.error(err)) },¡Gracias por tu ayuda!
si obtiene un error (en este caso, Timeout ), sus códigos nunca volverán a intentarlo. necesita hacer lo mismo en la instrucción catch:
updateReports() { // checks for new data, waits the given time, and checks again.. forever this.$VKS.Read('Report', { filter: { shared: this.user }}) .then(reports => { this.reports = reports // show the data to the user setTimeout(() => { this.updateReports() // start again }, 1000 * 60 * 10) // 10 minutes }).catch(err => { console.error(err); setTimeout(() => { this.updateReports() // start again }, 1000 * 60 * 10) // 10 minutes }) },