From af305aa196642c3dda66da6c2cd7ee9e5a45b97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Fri, 23 Oct 2020 10:08:34 +0200 Subject: [PATCH] refactor: remove unneeded code (see elasticsearch constructor) --- src/storage/elasticsearch/elasticsearch.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/storage/elasticsearch/elasticsearch.ts b/src/storage/elasticsearch/elasticsearch.ts index 9e2acf22..50c4ea67 100644 --- a/src/storage/elasticsearch/elasticsearch.ts +++ b/src/storage/elasticsearch/elasticsearch.ts @@ -369,7 +369,7 @@ export class Elasticsearch implements Database { public async bulkUpdated(bulk: Bulk): Promise { // if our es instance is not ready yet, we cannot serve this request if (!this.ready) { - throw new Error('Elasticsearch not ready'); + throw new Error('No connection to elasticsearch established yet.'); } // index name for elasticsearch @@ -463,7 +463,7 @@ export class Elasticsearch implements Database { throw new Error('Monitoring is defined, but MailQueue is undefined. A MailQueue is obligatory for monitoring.'); } // read all watches and schedule searches on the client - Monitoring.setUp(monitoringConfiguration, this.client, this.mailQueue); + await Monitoring.setUp(monitoringConfiguration, this.client, this.mailQueue); } return this.getAliasMap(); @@ -548,16 +548,10 @@ export class Elasticsearch implements Database { throw new Error('Database is undefined. You have to configure the query build'); } - // check if the database version is defined and in the expected format - if (typeof this.config.internal.database.version === 'undefined' - || typeof this.config.internal.database.version !== 'string') { - throw new Error('Database version is malformed. Check your config file'); - } - // create elasticsearch configuration out of data from database configuration const esConfig: ElasticsearchConfig = { name: this.config.internal.database.name as 'elasticsearch', - version: this.config.internal.database.version, + version: this.config.internal.database.version as string, }; if (typeof this.config.internal.database.query !== 'undefined') {