fix: address Bugbot review #2 findings
- Invalidate integration data cache from widget interact mutations (downloads, dns-hole, media-requests, indexer-manager, smart-home, anchor-notes) - Redis handler getExpiration: fetch missing tags from Redis (multi-instance coherence) - saveItemOptions: invalidate board cache after saving - Remove unused cacheTags.app - Fix integration data cache comment accuracy
This commit is contained in:
11 files changed
+60
-6
No files matched your search
@@ -152,13 +152,36 @@ export class RedisCacheHandler implements CacheHandler {
|
||||
async getExpiration(tags: string[]): Promise<number> {
|
||||
if (tags.length === 0) return 0;
|
||||
|
||||
const missingTags: string[] = [];
|
||||
let maxTimestamp = 0;
|
||||
|
||||
for (const tag of tags) {
|
||||
const cached = this.tagCache.get(tag);
|
||||
if (cached && cached > maxTimestamp) {
|
||||
maxTimestamp = cached;
|
||||
if (cached !== undefined) {
|
||||
if (cached > maxTimestamp) maxTimestamp = cached;
|
||||
} else {
|
||||
missingTags.push(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingTags.length > 0) {
|
||||
try {
|
||||
await this.redis.connect().catch(() => {});
|
||||
const keys = missingTags.map((t) => this.tagKey(t));
|
||||
const values = await this.redis.mget(...keys);
|
||||
for (let i = 0; i < missingTags.length; i++) {
|
||||
const val = values[i];
|
||||
if (val) {
|
||||
const ts = Number(val);
|
||||
this.tagCache.set(missingTags[i]!, ts);
|
||||
if (ts > maxTimestamp) maxTimestamp = ts;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Fail open
|
||||
}
|
||||
}
|
||||
|
||||
return maxTimestamp;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user