Skip to content

Commit 121ad80

Browse files
committed
fix: glitch on logout and re-login db get cleaned and fail on startup
1 parent ac7c182 commit 121ad80

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/core/broker/broker.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,17 @@ module.exports = class Broker extends EventEmitter {
3333
constructor(renderer) {
3434
super()
3535
this.renderer = renderer;
36-
this.db = new LinvoDB(DB)//, MOVIES_SCHEMA, {})
36+
3737
}
3838

39+
initDB() {
40+
/**
41+
* Initialize db
42+
* @type {function(*=): void}
43+
*/
44+
log.warn('Creating local db')
45+
this.db = new LinvoDB(DB)//, MOVIES_SCHEMA, {})
46+
}
3947

4048
flush() {
4149
/**
@@ -183,6 +191,7 @@ module.exports = class Broker extends EventEmitter {
183191
*/
184192
// Clean old listeners first
185193
log.info('Broker ready')
194+
this.initDB();
186195
this.stopIpcEvents();
187196
this.emitStart();
188197
this.listenForPartyRock();

0 commit comments

Comments
 (0)