Skip to content

Commit a1d509a

Browse files
authored
Patch tests from failing on subscription due to rate limits (#386)
<!-- greptile_comment --> ## Greptile Summary Modified error handling and test configuration in RemoteAccountUpdatesWorker to address 'too many requests' errors during testing. - Added conditional compilation (`#[cfg]`) in `magicblock-account-updates/src/remote_account_updates_worker.rs` to panic on shard failures during tests while logging errors in production - Reduced WebSocket connections from 2 to 1 in `magicblock-account-updates/tests/remote_account_updates.rs` to prevent rate limiting - Added `env_logger = "0.11"` to `magicblock-account-updates/Cargo.toml` for improved test logging - Consider adding retry mechanism or connection pooling for more robust testing <!-- /greptile_comment -->
1 parent 74c70c1 commit a1d509a

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

magicblock-account-updates/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ thiserror = { workspace = true }
2424

2525
[dev-dependencies]
2626
test-tools = { workspace = true }
27+
env_logger = { workspace = true }

magicblock-account-updates/src/remote_account_updates_worker.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ impl RemoteAccountUpdatesWorker {
186186
.start_monitoring_request_processing(shard_cancellation_token)
187187
.await
188188
{
189+
#[cfg(not(test))]
189190
error!("Runner shard has failed: {}: {:?}", shard_id, error);
191+
192+
#[cfg(test)]
193+
panic!("Runner shard has failed: {}: {:?}", shard_id, error);
190194
}
191195
});
192196
let runner = RemoteAccountUpdatesWorkerRunner {

magicblock-account-updates/tests/remote_account_updates.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ async fn setup() -> (
1919
CancellationToken,
2020
tokio::task::JoinHandle<()>,
2121
) {
22+
let _ = env_logger::builder().is_test(true).try_init();
2223
// Create account updates worker and client
2324
let mut worker = RemoteAccountUpdatesWorker::new(
24-
vec![RpcProviderConfig::devnet().ws_url().into(); 2],
25+
vec![RpcProviderConfig::devnet().ws_url().into(); 1],
2526
Some(solana_sdk::commitment_config::CommitmentLevel::Confirmed),
2627
Duration::from_secs(50 * 60),
2728
);

0 commit comments

Comments
 (0)