2 Commits

Author SHA1 Message Date
51c2d4f6e0 2.0.9 2022-07-30 18:03:17 +02:00
45091d6b8c fix(core): update 2022-07-30 18:03:17 +02:00
5 changed files with 12 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smartclickhouse", "name": "@pushrocks/smartclickhouse",
"version": "2.0.8", "version": "2.0.9",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smartclickhouse", "name": "@pushrocks/smartclickhouse",
"version": "2.0.8", "version": "2.0.9",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.13", "@pushrocks/smartdelay": "^2.0.13",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartclickhouse", "name": "@pushrocks/smartclickhouse",
"version": "2.0.8", "version": "2.0.9",
"private": false, "private": false,
"description": "an odm for talking to clickhouse", "description": "an odm for talking to clickhouse",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@ -7,6 +7,7 @@ tap.test('first test', async () => {
testClickhouseDb = new smartclickhouse.SmartClickHouseDb({ testClickhouseDb = new smartclickhouse.SmartClickHouseDb({
url: 'http://localhost:8123', url: 'http://localhost:8123',
database: 'test2', database: 'test2',
unref: true,
}); });
}); });

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartclickhouse', name: '@pushrocks/smartclickhouse',
version: '2.0.8', version: '2.0.9',
description: 'an odm for talking to clickhouse' description: 'an odm for talking to clickhouse'
} }

View File

@ -7,6 +7,12 @@ export interface IClickhouseConstructorOptions {
database: string; database: string;
username?: string; username?: string;
password?: 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 { export class SmartClickHouseDb {
@ -44,7 +50,7 @@ export class SmartClickHouseDb {
}); });
if (!available) { if (!available) {
console.log(`NOT OK: tried pinging ${this.options.url}... Trying again in 5 seconds.`); 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);
} }
} }
} }