Skip to content

Commit

Permalink
Merge pull request matter-labs#198 from matter-labs/baldyash/135/prov…
Browse files Browse the repository at this point in the history
…ertimeout

prover timeout
  • Loading branch information
jazzandrock authored Feb 18, 2020
2 parents 626e1d7 + 40992ce commit a262fd0
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 148 deletions.
17 changes: 17 additions & 0 deletions Cargo.lock

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

8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,16 @@ genesis: confirm_action

# Frontend clients

dist-config:
bin/.gen_js_config > js/client/src/env-config.js
bin/.gen_js_config > js/explorer/src/env-config.js

client:
@cd js/client && yarn serve

explorer: dist-config
explorer:
@cd js/explorer && yarn serve

dist-client:
@cd js/client && yarn build

dist-explorer: dist-config
dist-explorer:
@cd js/explorer && yarn build

image-nginx: dist-client dist-explorer
Expand Down
7 changes: 6 additions & 1 deletion core/models/src/config_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::node::Address;
use futures::{channel::mpsc, executor::block_on, SinkExt};
use std::env;
use std::net::SocketAddr;
use std::time;
use web3::types::{H160, H256};

/// If its placed inside thread::spawn closure it will notify channel when this thread panics.
pub struct ThreadPanicNotify(pub mpsc::Sender<bool>);

Expand Down Expand Up @@ -33,6 +33,7 @@ pub struct ConfigurationOptions {
pub gas_price_factor: usize,
pub tx_batch_size: usize,
pub prover_server_address: SocketAddr,
pub req_server_timeout: time::Duration,
}

impl ConfigurationOptions {
Expand Down Expand Up @@ -85,6 +86,10 @@ impl ConfigurationOptions {
prover_server_address: get_env("PROVER_SERVER_BIND")
.parse()
.expect("Failed to parse PROVER_SERVER_BIND bind address"),
req_server_timeout: get_env("REQ_SERVER_TIMEOUT")
.parse::<u64>()
.and_then(|d| Ok(time::Duration::from_secs(d)))
.expect("REQ_SERVER_TIMEOUT invalid value"),
}
}
}
1 change: 1 addition & 0 deletions core/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ num-traits = "0.2"
actix-web = "1.0"
reqwest = "0.9.22"
failure = "0.1"
backoff = "0.1.6"

[dev-dependencies]
testhelper = { path = "../testhelper", version = "0.1.0"}
7 changes: 2 additions & 5 deletions core/prover/src/bin/dummy_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::Duration;
// External deps
use log::info;
// Workspace deps
use models::node::config::{PROVER_CYCLE_WAIT, PROVER_GONE_TIMEOUT};
use models::node::config::PROVER_CYCLE_WAIT;
use models::EncodedProof;
use storage::ConnectionPool;

Expand All @@ -17,10 +17,7 @@ fn main() {
loop {
let storage = pool.access_storage().expect("Storage access");
let job = storage
.prover_run_for_next_commit(
worker,
time::Duration::from_secs(PROVER_GONE_TIMEOUT as u64),
)
.prover_run_for_next_commit(worker, time::Duration::from_secs(10))
.expect("prover job, db access");
if let Some(job) = job {
info!("Received job for block: {}", job.block_number);
Expand Down
Loading

0 comments on commit a262fd0

Please sign in to comment.