Merge pull request #9617 from backstage/rugvip/fixlab

catalog-backend: fixes for GitLab discovery .updateLastActivity()
This commit is contained in:
Ben Lambert
2022-02-17 17:40:36 +01:00
committed by GitHub
3 changed files with 9 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': minor
---
Made the `GitLabDiscoveryProcessor.updateLastActivity` method private, as it was accidentally exposed. It has also been fixed to properly operate in its own cache namespace to avoid collisions with other processors.
-2
View File
@@ -888,8 +888,6 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
_optional: boolean,
emit: CatalogProcessorEmit,
): Promise<boolean>;
// (undocumented)
updateLastActivity(): Promise<string | undefined>;
}
// Warning: (ae-missing-release-tag) "inputError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -142,9 +142,10 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
return true;
}
async updateLastActivity(): Promise<string | undefined> {
const lastActivity = await this.cache.get('last-activity');
await this.cache.set('last-activity', new Date().toISOString());
private async updateLastActivity(): Promise<string | undefined> {
const cacheKey = `processors/${this.getProcessorName()}/last-activity`;
const lastActivity = await this.cache.get(cacheKey);
await this.cache.set(cacheKey, new Date().toISOString());
return lastActivity as string | undefined;
}
}