From e9cf0dd03ec13d8da9b9c830ae083f91e0bb61ad Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 17 Feb 2022 15:18:13 +0100 Subject: [PATCH] catalog-backend: fixes for GitLab discovery .updateLastActivity() Signed-off-by: Patrik Oldsberg --- .changeset/red-olives-clap.md | 5 +++++ plugins/catalog-backend/api-report.md | 2 -- .../src/ingestion/processors/GitLabDiscoveryProcessor.ts | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 .changeset/red-olives-clap.md diff --git a/.changeset/red-olives-clap.md b/.changeset/red-olives-clap.md new file mode 100644 index 0000000000..ac8ac1cda6 --- /dev/null +++ b/.changeset/red-olives-clap.md @@ -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. diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index 2e01d2391b..f52bbdc22e 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -888,8 +888,6 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor { _optional: boolean, emit: CatalogProcessorEmit, ): Promise; - // (undocumented) - updateLastActivity(): Promise; } // Warning: (ae-missing-release-tag) "inputError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) diff --git a/plugins/catalog-backend/src/ingestion/processors/GitLabDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GitLabDiscoveryProcessor.ts index 36b7bfbcb5..0822d40ef6 100644 --- a/plugins/catalog-backend/src/ingestion/processors/GitLabDiscoveryProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/GitLabDiscoveryProcessor.ts @@ -142,9 +142,10 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor { return true; } - async updateLastActivity(): Promise { - const lastActivity = await this.cache.get('last-activity'); - await this.cache.set('last-activity', new Date().toISOString()); + private async updateLastActivity(): Promise { + 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; } }