Skip to content

Commit ccc2372

Browse files
Seulgi Kimmergify[bot]
authored andcommitted
No need to wait on exit
The current code is a hotfix to bypass the crash caused by the db that is open in the other threads. But now you do not have to wait because the previous commits fixed the main thread to wait for joining the child threads.
1 parent a8e638a commit ccc2372

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

codechain/run_node.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17-
use std::env;
1817
use std::fs;
1918
use std::path::Path;
2019
use std::sync::{Arc, Weak};
21-
use std::time::{Duration, SystemTime, UNIX_EPOCH};
20+
use std::time::{SystemTime, UNIX_EPOCH};
2221

2322
use ccore::{
2423
AccountProvider, AccountProviderError, ChainNotify, Client, ClientConfig, ClientService, EngineInfo, EngineType,
@@ -35,7 +34,6 @@ use csync::{BlockSyncExtension, BlockSyncSender, SnapshotService, TransactionSyn
3534
use ctimer::TimerLoop;
3635
use ctrlc::CtrlC;
3736
use fdlimit::raise_fd_limit;
38-
use finally_block::finally;
3937
use kvdb::KeyValueDB;
4038
use kvdb_rocksdb::{Database, DatabaseConfig};
4139
use parking_lot::{Condvar, Mutex};
@@ -227,17 +225,6 @@ pub fn run_node(matches: &ArgMatches) -> Result<(), String> {
227225

228226
let config = load_config(matches)?;
229227

230-
// FIXME: It is the hotfix for #348.
231-
// Remove the below code if you find the proper way to solve #348.
232-
let _wait = finally(|| {
233-
const DEFAULT: u64 = 1;
234-
let wait_before_shutdown = env::var_os("WAIT_BEFORE_SHUTDOWN")
235-
.and_then(|sec| sec.into_string().ok())
236-
.and_then(|sec| sec.parse().ok())
237-
.unwrap_or(DEFAULT);
238-
::std::thread::sleep(Duration::from_secs(wait_before_shutdown));
239-
});
240-
241228
let scheme = match &config.operating.chain {
242229
Some(chain) => chain.scheme()?,
243230
None => return Err("chain is not specified".to_string()),

test/src/helper/spawn.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ export default class CodeChain {
171171
}
172172
const useDebugBuild = process.env.NODE_ENV !== "production";
173173
process.env.RUST_LOG = logLevel;
174-
// NOTE: https://github.com/CodeChain-io/codechain/issues/348
175-
process.env.WAIT_BEFORE_SHUTDOWN = "0";
176174

177175
const baseArgs = [...this.argv, ...argv];
178176
if (disableIpc) {

0 commit comments

Comments
 (0)