Merge pull request #5901 from backstage/jhaals/legacy-catalog

Catalog: Make the new processing engine the default
This commit is contained in:
Johan Haals
2021-06-15 11:40:53 +02:00
committed by GitHub
26 changed files with 111 additions and 1277 deletions
+5 -39
View File
@@ -14,13 +14,9 @@
* limitations under the License.
*/
import { useHotCleanup } from '@backstage/backend-common';
import {
CatalogBuilder,
createRouter,
NextCatalogBuilder,
runPeriodically,
createNextRouter,
} from '@backstage/plugin-catalog-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
@@ -28,50 +24,20 @@ import { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
/*
* ** WARNING **
* DO NOT enable the experimental catalog, it will brick your database migrations.
* This is solely for internal backstage development.
*/
if (process.env.EXPERIMENTAL_CATALOG === '1') {
const builder = new NextCatalogBuilder(env);
const {
entitiesCatalog,
locationAnalyzer,
processingEngine,
locationService,
} = await builder.build();
// TODO(jhaals): run and manage in background.
await processingEngine.start();
return await createNextRouter({
entitiesCatalog,
locationAnalyzer,
locationService,
logger: env.logger,
config: env.config,
});
}
const builder = new CatalogBuilder(env);
const builder = await CatalogBuilder.create(env);
const {
entitiesCatalog,
locationsCatalog,
higherOrderOperation,
locationAnalyzer,
processingEngine,
locationService,
} = await builder.build();
useHotCleanup(
module,
runPeriodically(() => higherOrderOperation.refreshAllLocations(), 100000),
);
await processingEngine.start();
return await createRouter({
entitiesCatalog,
locationsCatalog,
higherOrderOperation,
locationAnalyzer,
locationService,
logger: env.logger,
config: env.config,
});