You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds a single #[ignore]d investigation harness (engine/packages/gasoline/tests/pull_backlog.rs) that reproduces slow pull_workflows calls under Postgres with added network latency. It's diagnostic-only (no production code changes), well documented, and correctly placed under tests/ per the repo's Rust test-layout convention.
I traced every API call against the current gasoline source to check for drift:
dispatch_workflow(ray_id, workflow_id, workflow_name, tags, input, unique), update_worker_ping(worker_id, worker_version, update_active_idx), and pull_workflows(worker_id, worker_version, filter, running_workflows_by_name) all match the Database trait signatures in db/mod.rs.
The PHASE_SPANS names (pull_workflows, read_wake_conditions, map_to_leased_workflows, pull_workflows_tx, clear_workflow_secondary_idx_tx, pull_workflow_history_tx) all correspond to real #[tracing::instrument]/debug_span!/info_span! names in db/kv/mod.rs.
All crates used (rivet-test-deps, futures-util, serde_json, tracing-subscriber, uuid, etc.) are already in gasoline's [dependencies], so no Cargo.toml changes are needed.
Formatting uses hard tabs throughout, matches rustfmt.toml.
The doc comment's claim ("a worker gives up when pull_workflows takes longer than its fixed pull timeout, and giving up stops every workflow it is running") matches worker.rs's tick(), which wraps pull_workflows in tokio::time::timeout(PULL_WORKFLOWS_TIMEOUT, ...) and propagates the error up through shutdown().
The docker run --net container:<name> --cap-add NET_ADMIN alpine:3 ... sidecar passes container_name as a discrete arg (not interpolated into a shell string), and the only value spliced into the inner sh -c string (rtt_ms) is a parsed u64, so there's no command-injection concern here despite the string formatting.
Minor / optional suggestions
Duplicated timeout constant risk of silent drift.PULL_WORKFLOWS_TIMEOUT is redefined here as Duration::from_secs(10) because the real one (worker.rs:30) is pub(crate) and not reachable from an integration test. The doc comment already explains this, so it's not hidden, but if the worker's real timeout ever changes, this harness's pass/fail threshold goes stale silently. Worth a tracking note, or exposing the constant behind a test-utils accessor if this harness is expected to be maintained long-term.
Hardcoded container suffix.add_network_latency(&format!("test-postgres-{test_id}-1"), rtt_ms) hardcodes the -1 datacenter-label suffix. It happens to be correct today because TestDeps::new_with_test_id always sets up a single datacenter with label 1 (per test-deps/src/lib.rs), but spelling it as config.dc_label() instead of a literal would make that assumption self-documenting and resilient if the harness is ever adapted to a multi-DC setup.
No assertion on pulled count, only on elapsed time. That's presumably intentional for an investigation tool (partial pulls due to the concurrency quota are expected), but a one-line comment on why pulled.len() isn't checked against backlog would save a future reader from wondering.
None of these are blocking; the harness is self-contained, #[ignore]d (won't affect CI), and doesn't touch any load-bearing code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.