Catch cache errors
parent
f44290cec3
commit
1ffc1b57f2
|
@ -556,14 +556,21 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
data = await dav.getPeopleData();
|
data = await dav.getPeopleData();
|
||||||
} else {
|
} else {
|
||||||
// Try the cache
|
// Try the cache
|
||||||
|
try {
|
||||||
cache = noCache ? null : (await utils.getCachedData(cacheUrl));
|
cache = noCache ? null : (await utils.getCachedData(cacheUrl));
|
||||||
if (cache) {
|
if (cache) {
|
||||||
await this.processDays(cache);
|
await this.processDays(cache);
|
||||||
this.loading--;
|
this.loading--;
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
console.warn(`Failed to process days cache: ${cacheUrl}`);
|
||||||
|
cache = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Get from network
|
// Get from network
|
||||||
data = (await axios.get<IDay[]>(url)).data;
|
const res = await axios.get<IDay[]>(url);
|
||||||
|
if (res.status !== 200) throw res; // don't cache this
|
||||||
|
data = res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put back into cache
|
// Put back into cache
|
||||||
|
@ -704,7 +711,12 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
this.sizedDays.add(dayId);
|
this.sizedDays.add(dayId);
|
||||||
|
|
||||||
// Look for cache
|
// Look for cache
|
||||||
this.processDay(dayId, await utils.getCachedData(this.getDayUrl(dayId)));
|
const cacheUrl = this.getDayUrl(dayId);
|
||||||
|
try {
|
||||||
|
this.processDay(dayId, await utils.getCachedData(cacheUrl));
|
||||||
|
} catch {
|
||||||
|
console.warn(`Failed to process day cache: ${cacheUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Aggregate fetch requests
|
// Aggregate fetch requests
|
||||||
this.fetchDayQueue.push(dayId);
|
this.fetchDayQueue.push(dayId);
|
||||||
|
@ -726,6 +738,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
try {
|
try {
|
||||||
const startState = this.state;
|
const startState = this.state;
|
||||||
const res = await axios.get<IPhoto[]>(url);
|
const res = await axios.get<IPhoto[]>(url);
|
||||||
|
if (res.status !== 200) throw res;
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
if (this.state !== startState) return;
|
if (this.state !== startState) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue