Skip to content

Commit

Permalink
Merge pull request #53 from ZorrillosDev/v1.0.1-multienv
Browse files Browse the repository at this point in the history
V1.0.1 multienv
  • Loading branch information
geolffreym authored Apr 22, 2021
2 parents 43d8cea + f912d71 commit 4f7448c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
18 changes: 8 additions & 10 deletions src/main/core/broker/broker.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,17 @@ module.exports = class Broker extends EventEmitter {
}


_flushDB() {
// Flush indexes on logout and remove db entries
//Object.keys(MOVIES_SCHEMA).forEach((k) => this.db.removeIndex(k, () => log.info('Index removed', k)))
this.db.remove({}, {multi: true},
(err, numRemoved) => log.info('Flushed db entries: ', numRemoved));
}


flush() {
/**
* Kill all this shit XD
* */
this._flushDB();
this.renderer.send('node-flush');

this.db.remove({}, {multi: true},
(err, numRemoved) => {
if (err) log.error(err)
log.info('Flushed db entries: ', numRemoved)
this.renderer.send('node-flush');
});
}

getIPC() {
Expand Down Expand Up @@ -185,6 +182,7 @@ module.exports = class Broker extends EventEmitter {
this.db.insert(collection, (e, n) => {
if (e) return; // Avoid `n.length` undefined
log.info(`Inserted: ${n?.length || 0}`)
log.info(`Total:`, this.db.getAllData().length)

}); // Save in local
this.emit('replicated')
Expand Down
1 change: 0 additions & 1 deletion src/main/core/ipfs/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const forceKill = async (isInstance) => {
await isInstance.start();
} catch (e) {
// Gateway stop
await forceKill(isInstance)
throw new Error('Fail starting node')
}

Expand Down
1 change: 1 addition & 0 deletions src/main/core/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ module.exports = class Node extends EventEmitter {
res(this.node)
} catch (e) {
log.error('Fail starting node')
log.info('Holding by:', this.holdby)
this.emit('node-error')
// Any other .. just retry
setTimeout(async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ app.whenReady().then(() => {
ipcMain.on('party', async () => {
if (key.existKey)
await removeFiles(key.keyFile)
ipcMain.emit('party-success') // Just after key being removed
removeCacheDirs(); // Clean old data dir
ipcMain.emit('party-success')

})

ipcMain.on('focus', () => win.focus())
Expand Down

0 comments on commit 4f7448c

Please sign in to comment.