Skip to content

Commit

Permalink
fix: Remove user facing errors for pre-aggregations refreshes
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Mar 1, 2020
1 parent dceaf46 commit d15c551
Showing 1 changed file with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,7 @@ class PreAggregationLoader {
await this.executeInQueue(invalidationKeys, this.priority(0), newVersionEntry);
return mostRecentTargetTableName();
} else {
if (
this.preAggregations.refreshErrors[newVersionEntry.table_name] &&
this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version] &&
this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version].counter > 10) {
throw this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version].error;
} else {
this.scheduleRefresh(invalidationKeys, newVersionEntry);
}
this.scheduleRefresh(invalidationKeys, newVersionEntry);
}
}
} else {
Expand Down Expand Up @@ -347,18 +340,8 @@ class PreAggregationLoader {
requestId: this.requestId
});
this.executeInQueue(invalidationKeys, this.priority(0), newVersionEntry)
.then(() => {
delete this.preAggregations.refreshErrors[newVersionEntry.table_name];
})
.catch(e => {
if (!(e instanceof ContinueWaitError)) {
this.preAggregations.refreshErrors[newVersionEntry.table_name] = this.preAggregations.refreshErrors[newVersionEntry.table_name] || {};
if (!this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version]) {
this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version] = { error: e, counter: 1 };
} else {
this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version].error = e;
this.preAggregations.refreshErrors[newVersionEntry.table_name][newVersionEntry.content_version].counter += 1;
}
this.logger('Error refreshing pre-aggregation', {
error: (e.stack || e), preAggregation: this.preAggregation, requestId: this.requestId
});
Expand Down Expand Up @@ -541,7 +524,6 @@ class PreAggregations {
this.driverFactory = clientFactory;
this.logger = logger;
this.queryCache = queryCache;
this.refreshErrors = {}; // TODO should be in redis
this.cacheDriver = options.cacheAndQueueDriver === 'redis' ?
new RedisCacheDriver(options.redisPool) :
new LocalCacheDriver();
Expand Down

0 comments on commit d15c551

Please sign in to comment.