Skip to content

Commit a6b15ae

Browse files
emizzleiurimatias
authored andcommitted
fix(@embark/cockpit): Switching between tabs resets logs
Switching between the two tabs shown on the Dashboard for the cockpit was removing some of the logs that were previously displayed. This was due to an overlap in `id`’s being assigned to the logs from different processes. To alleviate this, the reducers has been updated to not only check `id` but also `process.name`. Additionally, the reducer was updated so that the number of logs for **each process** is set to `ELEMENTS_LIMIT`. For example, our `ELEMENT_LIMIT` is currently set to `200` and it would have meant that the total number of process logs across all processes would have been capped at 200. The current changes in this PR allow for 400 total logs, given that we have two processes being monitored for logs.
1 parent 128ecd4 commit a6b15ae

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/embark-ui/src/reducers/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import {EMBARK_PROCESS_NAME, DARK_THEME, DEPLOYMENT_PIPELINES, DEFAULT_HOST, ELE
88

99
const BN_FACTOR = 10000;
1010
const VOID_ADDRESS = '0x0000000000000000000000000000000000000000';
11+
// This is set so that the total number of logs allowed in the entities state is ELEMENTS_LIMIT
12+
// multipled by the number of services we are monitoring for logs. As it stands currently, we
13+
// are monitoring only "embark" and "blockchain" logs, hence we are allowing ELEMENTS_LIMIT * 2.
14+
// TODO: If we update the number of services to show process logs, we need to update this number
15+
// to reflect the new number of services.
16+
const PROCESS_LOGS_LIMIT = ELEMENTS_LIMIT * 2;
1117

1218
const entitiesDefaultState = {
1319
accounts: [],
@@ -92,7 +98,7 @@ const filtrer = {
9298
},
9399
processLogs: function(processLog, index, self) {
94100
if (processLog.id !== undefined) {
95-
return index === self.findIndex((p) => p.id === processLog.id) && index <= ELEMENTS_LIMIT;
101+
return index === self.findIndex((p) => p.id === processLog.id && p.name === processLog.name) && index <= PROCESS_LOGS_LIMIT;
96102
}
97103
return true;
98104
},

packages/embark/src/cmd/cmd_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class EmbarkController {
103103
function initEngine(callback) {
104104
engine.init({}, () => {
105105
if (!options.useDashboard) {
106+
engine.startService("embarkListener");
106107
engine.logger.info('========================'.bold.green);
107108
engine.logger.info((__('Welcome to Embark') + ' ' + engine.version).yellow.bold);
108109
engine.logger.info('========================'.bold.green);
@@ -118,7 +119,6 @@ class EmbarkController {
118119

119120
engine.startService("processManager");
120121
engine.startService("coreProcess");
121-
engine.startService("embarkListener");
122122
engine.startService("blockchainListener");
123123
engine.startService("serviceMonitor");
124124
engine.startService("libraryManager");

0 commit comments

Comments
 (0)