From 9f706e0a7049d8a33b1d6f2fbc2aebe31744143c Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 25 Nov 2018 22:06:25 +0100 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 22 ---------------------- package.json | 2 +- ts/elasticsearch.classes.elasticindex.ts | 19 +++++++++++-------- ts/elasticsearch.classes.elasticsearch.ts | 14 +++++++------- 4 files changed, 19 insertions(+), 38 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 67fd2eb..8321aed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,18 +37,6 @@ snyk: # ==================== # test stage # ==================== -testLEGACY: - stage: test - script: - - npmci npm prepare - - npmci node install legacy - - npmci npm install - - npmci npm test - coverage: /\d+.?\d+?\%\s*coverage/ - tags: - - docker - - notpriv - allow_failure: true testLTS: stage: test @@ -135,13 +123,3 @@ pages: paths: - public allow_failure: true - -windowsCompatibility: - image: stefanscherer/node-windows:10-build-tools - stage: metadata - script: - - npm install & npm test - coverage: /\d+.?\d+?\%\s*coverage/ - tags: - - windows - allow_failure: true diff --git a/package.json b/package.json index 5a8f6ce..904083d 100644 --- a/package.json +++ b/package.json @@ -31,4 +31,4 @@ "@types/elasticsearch": "^5.0.28", "elasticsearch": "^15.2.0" } -} +} \ No newline at end of file diff --git a/ts/elasticsearch.classes.elasticindex.ts b/ts/elasticsearch.classes.elasticindex.ts index 7d0cd99..0cfaa3f 100644 --- a/ts/elasticsearch.classes.elasticindex.ts +++ b/ts/elasticsearch.classes.elasticindex.ts @@ -44,15 +44,18 @@ export class ElasticIndex { if (todayAsUnix - rententionPeriodAsUnix > dateAsUnix) { console.log(`found old index ${indexName}`); const done2 = plugins.smartpromise.defer(); - this.elasticSearchRef.client.indices.delete({ - index: indexName - }, (err2, response2) => { - if(err2) { - console.log(err2); + this.elasticSearchRef.client.indices.delete( + { + index: indexName + }, + (err2, response2) => { + if (err2) { + console.log(err2); + } + console.log(`deleted ${indexName}`); + done2.resolve(); } - console.log(`deleted ${indexName}`); - done2.resolve(); - }); + ); await done2.promise; } } diff --git a/ts/elasticsearch.classes.elasticsearch.ts b/ts/elasticsearch.classes.elasticsearch.ts index d008b50..1a88fc5 100644 --- a/ts/elasticsearch.classes.elasticsearch.ts +++ b/ts/elasticsearch.classes.elasticsearch.ts @@ -35,7 +35,7 @@ export class ElasticSearch { */ constructor(optionsArg: IElasticSearchConstructorOptions) { this.client = new ElasticClient({ - host: this.computeHostString(optionsArg), + host: this.computeHostString(optionsArg) // log: 'trace' }); this.indexPrefix = optionsArg.indexPrefix; @@ -61,10 +61,10 @@ export class ElasticSearch { public async log(logPackageArg: ILogPackage, scheduleOverwrite = false) { const now = new Date(); - const indexToUse = `${this.indexPrefix}-${now.getFullYear()}.${('0' + (now.getMonth() + 1)).slice(-2)}.${( - '0' + now.getDate() - ).slice(-2)}`; - + const indexToUse = `${this.indexPrefix}-${now.getFullYear()}.${( + '0' + + (now.getMonth() + 1) + ).slice(-2)}.${('0' + now.getDate()).slice(-2)}`; if (this.elasticScheduler.docsScheduled && !scheduleOverwrite) { this.elasticScheduler.scheduleDoc(logPackageArg); @@ -94,11 +94,11 @@ export class ElasticSearch { ); } - get logDestination (): ILogDestination { + get logDestination(): ILogDestination { return { handleLog: (smartlogPackageArg: ILogPackage) => { this.log(smartlogPackageArg); } - } + }; } }