Skip to content

Commit

Permalink
Merge pull request #424 from DeFiCh/fix/shutdown_node
Browse files Browse the repository at this point in the history
chore: added logs and bump app version
  • Loading branch information
monstrobishi committed Jan 29, 2021
2 parents 44b6685 + 49b887a commit 4c0570c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
7 changes: 5 additions & 2 deletions electron-app/src/services/defiprocessmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export default class DefiProcessManager {

static async stop() {
try {
log.info('Stopping DeFi Process Manager');
log.info('[Stop Node] Start DeFiProcessManager shutdown...');
const pid = getFileData(PID_FILE_NAME);
while (true) {
log.info('Attempting Defi Process Manager Stop...');
Expand All @@ -197,13 +197,16 @@ export default class DefiProcessManager {
}

static async restart(args: any, event: Electron.IpcMainEvent) {
log.info('Restart node started');
log.info('[Restart Node] Starting');
const stopResponse = await this.stop();
log.info('[Restart Node] Stop completed');
if (args && args.updatedConf && Object.keys(args.updatedConf).length) {
const updatedConfigData = ini.encode(args.updatedConf);
writeFile(CONFIG_FILE_NAME, updatedConfigData, false);
}
log.info('[Restart Node] Restarting DefiProcessManager');
const startResponse = await this.start(args || {}, event);
log.info('[Restart Node] Start completed');
if (
stopResponse &&
startResponse &&
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "defi-app",
"version": "2.1.13",
"version": "2.1.14",
"description": "DeFi Blockchain App",
"main": "./electron-app/build/electron-app/index.js",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "defi-app",
"version": "2.1.13",
"version": "2.1.14",
"description": "DeFi Blockchain App",
"author": {
"name": "DeFiChain Foundation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports[`Console component snapshot test of console component 1`] = `
continue={[Function]}
handler={[Function]}
promptLabel=""
welcomeMessage="defi-app_v2.1.13"
welcomeMessage="defi-app_v2.1.14"
>
<div
className="react-console-container react-console-focus"
Expand All @@ -42,7 +42,7 @@ exports[`Console component snapshot test of console component 1`] = `
<div
className="react-console-message react-console-welcome"
>
defi-app_v2.1.13
defi-app_v2.1.14
</div>
<ConsolePrompt
argument={null}
Expand Down
8 changes: 6 additions & 2 deletions webapp/src/containers/RpcConfiguration/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ import { WALLET_TOKENS_PATH } from '../../constants';
function* blockChainNotStarted(message) {
const { isRunning } = yield select((state) => state.app);
if (!isRunning) {
log.error(`${message ?? ''}`, 'blockChainNotStarted - Not Running');
yield put(startNodeFailure(message));
log.error(`${message ?? ''}`, 'startNodeFailure - blockChainNotStarted');
} else yield put(openErrorModal());
} else {
log.error(`Node is disconnected`, 'blockChainNotStarted - Running');
yield put(openErrorModal());
}
}

function* resetAppRoute() {
Expand All @@ -55,6 +58,7 @@ export function* getConfig() {
const chan = yield call(startBinary, res.data);
while (true) {
const blockchainStatus = yield take(chan);
log.info(blockchainStatus, 'Blockchain Status');
if (blockchainStatus.status) {
yield put(startNodeSuccess());
yield put(closeRestartLoader());
Expand Down

0 comments on commit 4c0570c

Please sign in to comment.