fix(core): update
This commit is contained in:
@@ -66,6 +66,7 @@ export class TimeDataTable {
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
public healingDeferred: plugins.smartpromise.Deferred<any>;
|
||||
public smartClickHouseDbRef: SmartClickHouseDb;
|
||||
public options: ITimeDataTableOptions;
|
||||
|
||||
@@ -92,6 +93,7 @@ export class TimeDataTable {
|
||||
* stores a json and tries to map it to the nested syntax
|
||||
*/
|
||||
public async addData(dataArg: any) {
|
||||
|
||||
// the storageJson
|
||||
let storageJson: { [key: string]: any } = {};
|
||||
|
||||
@@ -164,7 +166,18 @@ export class TimeDataTable {
|
||||
|
||||
const result = await this.smartClickHouseDbRef.clickhouseClient.insertPromise(this.options.tableName, [
|
||||
storageJson,
|
||||
]);
|
||||
]).catch(async () => {
|
||||
if (this.healingDeferred) {
|
||||
return;
|
||||
}
|
||||
this.healingDeferred = plugins.smartpromise.defer();
|
||||
console.log(`Ran into an error. Trying to set up things properly again.`);
|
||||
await this.smartClickHouseDbRef.pingDatabaseUntilAvailable();
|
||||
await this.smartClickHouseDbRef.createDatabase();
|
||||
this.columns = [];
|
||||
this.healingDeferred.resolve();
|
||||
this.healingDeferred = null;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user