Skip to content

Commit

Permalink
reinitialize the cache entry in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Dec 12, 2023
1 parent e334a4d commit b6de71c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/engine/paima-funnel/src/funnels/FunnelCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export class CarpFunnelCacheEntry implements FunnelCacheEntry {
}
}

public initialized(): boolean {
return !!this.state;
}

public getState(): Readonly<CarpFunnelCacheEntryState> {
if (!this.state) {
throw new Error('[carp-funnel] Uninitialized cache entry');
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/paima-funnel/src/funnels/carp/funnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class CarpFunnel extends BaseFunnel implements ChainFunnel {

const cacheEntry = (async (): Promise<CarpFunnelCacheEntry> => {
const entry = sharedData.cacheManager.cacheEntries[CarpFunnelCacheEntry.SYMBOL];
if (entry != null) return entry;
if (entry != null && entry.initialized()) return entry;

const newEntry = new CarpFunnelCacheEntry();
sharedData.cacheManager.cacheEntries[CarpFunnelCacheEntry.SYMBOL] = newEntry;
Expand Down

0 comments on commit b6de71c

Please sign in to comment.