Skip to content

Commit c39c9b6

Browse files
committed
Merge pull request #80 from jorisbontje/deploy-timeout-config
configurable deploy timeout per environment
2 parents 14b4cab + 1d54018 commit c39c9b6

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

demo/config/blockchain.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ staging:
1919
rpc_whitelist: "*"
2020
datadir: default
2121
network_id: 0
22+
deploy_timeout: 45
2223
console: true
2324
account:
2425
init: false

lib/config/blockchain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ BlockchainConfig.prototype.config = function(env) {
4141
genesisBlock: config.genesis_block,
4242
datadir: config.datadir,
4343
chains: config.chains,
44+
deployTimeout: config.deploy_timeout || 20,
4445
networkId: networkId,
4546
maxPeers: 4,
4647
port: config.port || "30303",

lib/deploy.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams) {
3939
while ((receipt = web3.eth.getTransactionReceipt(transactionHash)) === null || receipt.contractAddress === null) {
4040
sleep(1000);
4141
time += 1;
42-
if (time >= 20) {
42+
if (time >= this.blockchainConfig.deployTimeout) {
4343
return false;
4444
}
4545
}
@@ -176,4 +176,3 @@ Deploy.prototype.generate_and_write_abi_file = function(destFile) {
176176
};
177177

178178
module.exports = Deploy;
179-

test/config.blockchain.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe('embark.config.blockchain', function() {
4444
genesis_block: 'config/genesis.json',
4545
datadir: '/tmp/embark',
4646
chains: 'chains_development.json',
47+
deploy_timeout: 45,
4748
mine_when_needed: true,
4849
gas_limit: 123,
4950
gas_price: 100,
@@ -69,6 +70,7 @@ describe('embark.config.blockchain', function() {
6970
genesisBlock: 'config/genesis.json',
7071
datadir: '/tmp/embark',
7172
chains: 'chains_development.json',
73+
deployTimeout: 45,
7274
networkId: 0,
7375
maxPeers: 4,
7476
port: "30303",
@@ -114,6 +116,7 @@ describe('embark.config.blockchain', function() {
114116
genesisBlock: undefined,
115117
datadir: '/tmp/embark',
116118
chains: undefined,
119+
deployTimeout: 20,
117120
networkId: 0,
118121
maxPeers: 4,
119122
port: "30303",

0 commit comments

Comments
 (0)