From 45091d6b8c22d47ba98d14fac140c6e07ca124c7 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sat, 30 Jul 2022 18:03:17 +0200 Subject: [PATCH] fix(core): update --- test/test.nonci.ts | 1 + ts/00_commitinfo_data.ts | 2 +- ts/smartclickhouse.classes.smartclickhouse.ts | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/test.nonci.ts b/test/test.nonci.ts index 86a99ca..e05e46e 100644 --- a/test/test.nonci.ts +++ b/test/test.nonci.ts @@ -7,6 +7,7 @@ tap.test('first test', async () => { testClickhouseDb = new smartclickhouse.SmartClickHouseDb({ url: 'http://localhost:8123', database: 'test2', + unref: true, }); }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 136040d..8775b43 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartclickhouse', - version: '2.0.8', + version: '2.0.9', description: 'an odm for talking to clickhouse' } diff --git a/ts/smartclickhouse.classes.smartclickhouse.ts b/ts/smartclickhouse.classes.smartclickhouse.ts index 7938554..140c9f6 100644 --- a/ts/smartclickhouse.classes.smartclickhouse.ts +++ b/ts/smartclickhouse.classes.smartclickhouse.ts @@ -7,6 +7,12 @@ export interface IClickhouseConstructorOptions { database: string; username?: string; password?: string; + /** + * allow services to exit when waiting for clickhouse startup + * this allows to leave the lifecycle flow to other processes + * like a listening server. + */ + unref?: boolean; } export class SmartClickHouseDb { @@ -44,7 +50,7 @@ export class SmartClickHouseDb { }); if (!available) { console.log(`NOT OK: tried pinging ${this.options.url}... Trying again in 5 seconds.`); - await plugins.smartdelay.delayFor(5000); + await plugins.smartdelay.delayFor(5000, null, this.options.unref); } } }