Commit e35460c2 authored by Eriksson Monteiro's avatar Eriksson Monteiro

update millix wallet ui and millix node

parent a55b0d52
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -25,8 +25,8 @@ class _4wR3kjTwwC67R94Z extends Endpoint { ...@@ -25,8 +25,8 @@ class _4wR3kjTwwC67R94Z extends Endpoint {
wallet.stop(); wallet.stop();
network.stop(); network.stop();
peer.stop(); peer.stop();
database.runVacuum() database.runVacuumAll()
.then(() => database.runWallCheckpoint()) .then(() => database.runWallCheckpointAll())
.then(() => { .then(() => {
return wallet.initialize(true) return wallet.initialize(true)
.then(() => network.initialize()) .then(() => network.initialize())
......
...@@ -772,7 +772,7 @@ export const DATABASE_ENGINE = 'sqlite'; ...@@ -772,7 +772,7 @@ export const DATABASE_ENGINE = 'sqlite';
export const DATABASE_CONNECTION = {}; export const DATABASE_CONNECTION = {};
export const MILLIX_CIRCULATION = 9e15; export const MILLIX_CIRCULATION = 9e15;
export const NODE_MILLIX_BUILD_DATE = 1640009160; export const NODE_MILLIX_BUILD_DATE = 1640009160;
export const NODE_MILLIX_VERSION = '1.14.4-tangled'; export const NODE_MILLIX_VERSION = '1.14.5-tangled';
export const DATA_BASE_DIR_MAIN_NETWORK = './millix-tangled'; export const DATA_BASE_DIR_MAIN_NETWORK = './millix-tangled';
export const DATA_BASE_DIR_TEST_NETWORK = './millix-tangled'; export const DATA_BASE_DIR_TEST_NETWORK = './millix-tangled';
let DATA_BASE_DIR = MODE_TEST_NETWORK ? DATA_BASE_DIR_TEST_NETWORK : DATA_BASE_DIR_MAIN_NETWORK; let DATA_BASE_DIR = MODE_TEST_NETWORK ? DATA_BASE_DIR_TEST_NETWORK : DATA_BASE_DIR_MAIN_NETWORK;
......
...@@ -65,7 +65,7 @@ export class Database { ...@@ -65,7 +65,7 @@ export class Database {
} }
else if (key.endsWith('_in')) { else if (key.endsWith('_in')) {
sql += `${key.substring(0, key.lastIndexOf('_'))} IN (${where[key].map(() => '?').join(',')})`; sql += `${key.substring(0, key.lastIndexOf('_'))} IN (${where[key].map(() => '?').join(',')})`;
for(let parameter of where[key]) { for (let parameter of where[key]) {
parameters.push(parameter); parameters.push(parameter);
} }
return; return;
...@@ -521,11 +521,21 @@ export class Database { ...@@ -521,11 +521,21 @@ export class Database {
}); });
} }
runWallCheckpoint() { runWallCheckpointAll() {
return new Promise(resolve => {
async.eachSeries(_.keys(this.shards), (shardID, callback) => {
Database.runWallCheckpoint(this.shards[shardID].database)
.then(callback)
.catch(callback);
}, () => resolve());
});
}
static runWallCheckpoint(db) {
return new Promise(resolve => { return new Promise(resolve => {
mutex.lock(['transaction'], (unlock) => { mutex.lock(['transaction'], (unlock) => {
console.log('[database] locking for wal checkpoint'); console.log('[database] locking for wal checkpoint');
this.databaseMillix.run('PRAGMA wal_checkpoint(TRUNCATE)', function(err) { db.run('PRAGMA wal_checkpoint(TRUNCATE)', function(err) {
if (err) { if (err) {
console.log('[database] wal checkpoint error', err); console.log('[database] wal checkpoint error', err);
} }
...@@ -539,11 +549,21 @@ export class Database { ...@@ -539,11 +549,21 @@ export class Database {
}); });
} }
runVacuum() { runVacuumAll() {
return new Promise(resolve => {
async.eachSeries(_.keys(this.shards), (shardID, callback) => {
Database.runVacuum(this.shards[shardID].database)
.then(callback)
.catch(callback);
}, () => resolve());
});
}
static runVacuum(db) {
return new Promise(resolve => { return new Promise(resolve => {
mutex.lock(['transaction'], (unlock) => { mutex.lock(['transaction'], (unlock) => {
console.log('[database] locking for vacuum'); console.log('[database] locking for vacuum');
this.databaseMillix.run('VACUUM; PRAGMA wal_checkpoint(TRUNCATE);', function(err) { db.run('VACUUM; PRAGMA wal_checkpoint(TRUNCATE);', function(err) {
if (err) { if (err) {
console.log('[database] vacuum error', err); console.log('[database] vacuum error', err);
} }
...@@ -620,7 +640,8 @@ export class Database { ...@@ -620,7 +640,8 @@ export class Database {
.then(() => this._initializeJobEngineSqlite3()) .then(() => this._initializeJobEngineSqlite3())
.then(() => this._migrateTables()) .then(() => this._migrateTables())
.then(() => this._initializeShards()) .then(() => this._initializeShards())
.then(() => this._initializeTables()); .then(() => this._initializeTables())
.then(() => this.runWallCheckpointAll());
} }
return Promise.resolve(); return Promise.resolve();
} }
......
...@@ -126,6 +126,6 @@ db.initialize() ...@@ -126,6 +126,6 @@ db.initialize()
}); });
} }
}); });
//millix v1.14.4-tangled //millix v1.14.5-tangled
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment