diff --git a/.changeset/sweet-zoos-clap.md b/.changeset/sweet-zoos-clap.md new file mode 100644 index 0000000000..8c76f4abd7 --- /dev/null +++ b/.changeset/sweet-zoos-clap.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Fixed bug in stitching queue gauge that included entities that are scheduled in the future. diff --git a/plugins/catalog-backend/src/stitching/progressTracker.ts b/plugins/catalog-backend/src/stitching/progressTracker.ts index 9e00a1a01b..8c305b4978 100644 --- a/plugins/catalog-backend/src/stitching/progressTracker.ts +++ b/plugins/catalog-backend/src/stitching/progressTracker.ts @@ -54,7 +54,8 @@ export function progressTracker(knex: Knex, logger: LoggerService) { stitchingQueueCount.addCallback(async result => { const total = await knex('refresh_state') .count({ count: '*' }) - .whereNotNull('next_stitch_at'); + .whereNotNull('next_stitch_at') + .where('next_stitch_at', '<=', knex.fn.now()); result.observe(Number(total[0].count)); });