Break out the location refresh loop as well

This commit is contained in:
Fredrik Adelöw
2020-06-02 13:35:59 +02:00
parent bd7b9023aa
commit 17a16f617c
9 changed files with 347 additions and 441 deletions
+3 -6
View File
@@ -32,7 +32,6 @@ export default async function createPlugin({
logger,
database,
}: PluginEnvironment) {
const policy = new EntityPolicies();
const ingestionModel = new IngestionModels(
new LocationReaders(),
new DescriptorParsers(),
@@ -40,19 +39,17 @@ export default async function createPlugin({
);
const db = await DatabaseManager.createDatabase(database, logger);
runPeriodically(
() => DatabaseManager.refreshLocations(db, ingestionModel, policy, logger),
10000,
);
const entitiesCatalog = new DatabaseEntitiesCatalog(db);
const locationsCatalog = new DatabaseLocationsCatalog(db);
const higherOrderOperation = new HigherOrderOperations(
entitiesCatalog,
locationsCatalog,
ingestionModel,
logger,
);
runPeriodically(() => higherOrderOperation.refreshAllLocations(), 10000);
return await createRouter({
entitiesCatalog,
locationsCatalog,