mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
Production showed nostr-pub.wellorder.net repeatedly completing a WebSocket handshake, resetting under normal REQ load 30-42 seconds later, and returning to the five-second base reconnect delay. The health tracker cleared its failure streak at handshake time even though its state model and documentation already required five minutes of stable recovery. Preserve connection-failure history across recovered handshakes, promote a connected relay only after the existing five-minute stability period, and remove the redundant quick-reconnect success record. A relay continues normal live and historic work while degraded; only its next reconnect delay escalates. Active rate-limit cooldown accounting remains independent. A WebSocket/REQ fixture reproduces the short-lived-success lifecycle and verifies the recovered session retains its failure count. Unit tests cover escalated backoff, stable promotion, and the rule that disconnected relays cannot age into recovery. Correctness assumes an uninterrupted five-minute session under normal workload is sufficient evidence to forgive the streak. Intermittent sessions remain one instability episode, including for the existing 24-hour dead-relay threshold. Changing workload pace, stability duration, backoff configuration, or relay subscription policy is deliberately excluded. Validated with cargo test --lib (650 passed), cargo test --test sync (88 passed, 1 ignored), the focused reconnect scenario, and nix build .#ngit-grasp.
25 lines
741 B
Rust
25 lines
741 B
Rust
//! Common test utilities
|
|
#![allow(dead_code)] // Test helpers may not be used in all test configurations
|
|
#![allow(unused_imports)] // Re-exports may not be used in all test configurations
|
|
|
|
pub mod censoring_proxy;
|
|
pub mod flapping_relay;
|
|
pub mod git_server;
|
|
pub mod mock_relay;
|
|
pub mod neg_limiting_proxy;
|
|
pub mod nip09_helpers;
|
|
pub mod req_limiting_proxy;
|
|
pub mod upload_pack_counting_proxy;
|
|
pub mod port;
|
|
pub mod purgatory_helpers;
|
|
pub mod relay;
|
|
pub mod sync_helpers;
|
|
|
|
pub use git_server::{SimpleGitServer, SmartGitServer};
|
|
pub use mock_relay::MockRelay;
|
|
pub use nip09_helpers::*;
|
|
pub use port::{reserve_port, PortReservation};
|
|
pub use purgatory_helpers::*;
|
|
pub use relay::{DeletionLifecycleOptions, TestRelay};
|
|
pub use sync_helpers::*;
|