mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 14:34:40 +00:00
Add LOG_LIMIT to limit max log response size
Re-adds the log limit feature that limits the log size coming back from embark Also adds the log limit to other process logs (ie blockchain).
This commit is contained in:
parent
64713254f6
commit
145f376000
@ -108,7 +108,7 @@ export const commands = {
|
|||||||
|
|
||||||
export const PROCESS_LOGS = createRequestTypes('PROCESS_LOGS');
|
export const PROCESS_LOGS = createRequestTypes('PROCESS_LOGS');
|
||||||
export const processLogs = {
|
export const processLogs = {
|
||||||
request: (processName) => action(PROCESS_LOGS[REQUEST], {processName}),
|
request: (processName, limit) => action(PROCESS_LOGS[REQUEST], {processName, limit}),
|
||||||
success: (processLogs) => action(PROCESS_LOGS[SUCCESS], {processLogs}),
|
success: (processLogs) => action(PROCESS_LOGS[SUCCESS], {processLogs}),
|
||||||
failure: (error) => action(PROCESS_LOGS[FAILURE], {error})
|
failure: (error) => action(PROCESS_LOGS[FAILURE], {error})
|
||||||
};
|
};
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export const EMBARK_PROCESS_NAME = 'embark';
|
export const EMBARK_PROCESS_NAME = 'embark';
|
||||||
|
export const LOG_LIMIT = 50;
|
@ -14,7 +14,7 @@ import {
|
|||||||
import DataWrapper from "../components/DataWrapper";
|
import DataWrapper from "../components/DataWrapper";
|
||||||
import Processes from '../components/Processes';
|
import Processes from '../components/Processes';
|
||||||
import Console from '../components/Console';
|
import Console from '../components/Console';
|
||||||
import {EMBARK_PROCESS_NAME} from '../constants';
|
import {EMBARK_PROCESS_NAME, LOG_LIMIT} from '../constants';
|
||||||
import ContractsList from '../components/ContractsList';
|
import ContractsList from '../components/ContractsList';
|
||||||
import {getContracts, getProcesses, getProcessLogs} from "../reducers/selectors";
|
import {getContracts, getProcesses, getProcessLogs} from "../reducers/selectors";
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ class HomeContainer extends Component {
|
|||||||
|
|
||||||
if (processName === EMBARK_PROCESS_NAME) {
|
if (processName === EMBARK_PROCESS_NAME) {
|
||||||
if (this.props.processLogs.length === 0) {
|
if (this.props.processLogs.length === 0) {
|
||||||
this.props.fetchProcessLogs(processName);
|
this.props.fetchProcessLogs(processName, LOG_LIMIT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.props.fetchProcessLogs(processName);
|
this.props.fetchProcessLogs(processName, LOG_LIMIT);
|
||||||
this.props.listenToProcessLogs(processName);
|
this.props.listenToProcessLogs(processName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,9 @@ class ProcessLauncher {
|
|||||||
'get',
|
'get',
|
||||||
apiRoute,
|
apiRoute,
|
||||||
(_req, res) => {
|
(_req, res) => {
|
||||||
const result = self.logs.map((log, id) => Object.assign(log, {id})).slice(-50);
|
let limit = parseInt(req.query.limit, 10);
|
||||||
|
if(!Number.isInteger(limit)) limit = 0;
|
||||||
|
const result = self.logs.map((log, id) => Object.assign(log, {id})).slice(limit);
|
||||||
res.send(JSON.stringify(result));
|
res.send(JSON.stringify(result));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user