Skip to content

Commit fb0ec9b

Browse files
author
Ivo Georgiev
authored
Merge pull request #262 from AdExNetwork/logging-and-fixes
Logging and fixes
2 parents 864c6ff + daa67b5 commit fb0ec9b

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ RUN apt update && apt-get install -y libssl-dev
3838

3939
COPY --from=builder /usr/local/bin/validator_worker .
4040

41-
ENTRYPOINT validator_worker -a ${ADAPTER:-ethereum} \
41+
CMD validator_worker -a ${ADAPTER:-ethereum} \
4242
${KEYSTORE_FILE:+-k $KEYSTORE_FILE} \
4343
${DUMMY_IDENTITY:+-i $DUMMY_IDENTITY} \
4444
${SINGLE_TICK:+-t} \
45-
${SENTRY_URL:+-u $SENTRY_URL} ${CONFIG}
45+
${SENTRY_URL:+-u $SENTRY_URL} ${CONFIG}

sentry/src/event_aggregator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl EventAggregator {
111111
break;
112112
}
113113

114-
delay_for(Duration::from_secs(aggr_throttle as u64)).await;
114+
delay_for(Duration::from_millis(aggr_throttle as u64)).await;
115115
store(&dbpool, &channel_id, &logger, recorder.clone()).await;
116116
}
117117
});

validator_worker/src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use primitives::adapter::{Adapter, DummyAdapterOptions, KeystoreOptions};
1515
use primitives::config::{configuration, Config};
1616
use primitives::util::tests::prep_db::{AUTH, IDS};
1717
use primitives::{Channel, SpecValidator, ValidatorId};
18-
use slog::{error, Logger};
18+
use slog::{error, info, Logger};
1919
use validator_worker::error::ValidatorWorker as ValidatorWorkerError;
2020
use validator_worker::{all_channels, follower, leader, SentryApi};
2121

@@ -149,7 +149,7 @@ fn run<A: Adapter + 'static>(
149149
async fn infinite<A: Adapter + 'static>(args: Args<A>, logger: &Logger) {
150150
loop {
151151
let arg = args.clone();
152-
let delay_future = delay_for(Duration::from_secs(arg.config.wait_time as u64));
152+
let delay_future = delay_for(Duration::from_millis(arg.config.wait_time as u64));
153153
let _result = join(iterate_channels(arg, logger), delay_future).await;
154154
}
155155
}
@@ -174,6 +174,8 @@ async fn iterate_channels<A: Adapter + 'static>(args: Args<A>, logger: &Logger)
174174
)
175175
.await;
176176

177+
info!(logger, "processed {} channels", channels_size);
178+
177179
if let Err(e) = tick {
178180
error!(logger, "An occurred while processing channels {}", &e; "main" => "iterate_channels");
179181
}
@@ -192,7 +194,7 @@ async fn validator_tick<A: Adapter + 'static>(
192194
let whoami = adapter.whoami().clone();
193195
// Cloning the `Logger` is cheap, see documentation for more info
194196
let sentry = SentryApi::init(adapter, &channel, &config, logger.clone())?;
195-
let duration = Duration::from_secs(config.validator_tick_timeout as u64);
197+
let duration = Duration::from_millis(config.validator_tick_timeout as u64);
196198

197199
match channel.spec.validators.find(&whoami) {
198200
SpecValidator::Leader(_) => {

validator_worker/src/sentry_interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<T: Adapter + 'static> SentryApi<T> {
3434
logger: Logger,
3535
) -> Result<Self, ValidatorWorker> {
3636
let client = Client::builder()
37-
.timeout(Duration::from_secs(config.fetch_timeout.into()))
37+
.timeout(Duration::from_millis(config.fetch_timeout.into()))
3838
.build()
3939
.map_err(|e| ValidatorWorker::Failed(format!("building Client error: {}", e)))?;
4040

0 commit comments

Comments
 (0)