Skip to content

Commit

Permalink
[PLA-1641] Reduce GetPendingWallets poll interval (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Feb 27, 2024
1 parent 549da74 commit 7d8495b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ RUN rm -rf /var/lib/apt/lists/*

COPY --from=builder /wallet/target/release/wallet /usr/local/bin
COPY --from=builder /wallet/scripts/start.sh /usr/local/bin
RUN chmod +x /usr/local/bin/start.sh

# STORE_NAME = the storage name, this is a hex number which is the file name where the key is stored,
# it's generated when the key is generate (In the current example: `73723235301cb3057d43941d5f631613aa1661be0354d39e34f23d4ef527396b10d2bb7a`)
Expand Down
14 changes: 8 additions & 6 deletions bin/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ use wallet_lib::wallet_trait::Wallet;
use wallet_lib::*;

/// Time in milliseconds that a block is expected to be generated.
const BLOCKTIME_MS: u64 = 12000;
const POLL_TRANSACTION_MS: u64 = 12000;
const POLL_ACCOUNT_MS: u64 = 2500;

/// Page size for the number of transaction requests that are brought with each polling.
const PAGE_SIZE: usize = 40;
const TRANSACTION_PAGE_SIZE: usize = 50;
const ACCOUNT_PAGE_SIZE: usize = 200;

#[derive(GraphQLQuery)]
#[graphql(
Expand Down Expand Up @@ -149,17 +151,17 @@ async fn main() {
let (poll_job, sign_processor) = create_job_pair(
graphql_endpoint.clone(),
String::from(token.clone()),
Duration::from_millis(BLOCKTIME_MS),
Duration::from_millis(POLL_TRANSACTION_MS),
Arc::clone(&wallet_pair),
PAGE_SIZE.try_into().unwrap(),
TRANSACTION_PAGE_SIZE.try_into().unwrap(),
);

let (poll_wallet_job, derive_wallet_processor) = create_wallet_job_pair(
graphql_endpoint,
String::from(token.clone()),
Duration::from_millis(BLOCKTIME_MS),
Duration::from_millis(POLL_ACCOUNT_MS),
Arc::clone(&wallet_pair),
PAGE_SIZE.try_into().unwrap(),
ACCOUNT_PAGE_SIZE.try_into().unwrap(),
);

poll_job.start_job();
Expand Down

0 comments on commit 7d8495b

Please sign in to comment.