MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / receive_direct_pg_dump_socket

Function receive_direct_pg_dump_socket

src/pglite/pg_dump.rs:527–550  ·  view source on GitHub ↗
(
    socket_rx: &Receiver<PgDumpVirtualSocket>,
    runner: &thread::JoinHandle<Result<String>>,
)

Source from the content-addressed store, hash-verified

525}
526
527fn receive_direct_pg_dump_socket(
528 socket_rx: &Receiver<PgDumpVirtualSocket>,
529 runner: &thread::JoinHandle<Result<String>>,
530) -> Result<PgDumpVirtualSocket> {
531 let started = Instant::now();
532 loop {
533 match socket_rx.recv_timeout(Duration::from_millis(5)) {
534 Ok(socket) => return Ok(socket),
535 Err(mpsc::RecvTimeoutError::Timeout) => {
536 if runner.is_finished() {
537 bail!("pg_dump exited before opening the direct virtual protocol connection");
538 }
539 if started.elapsed() > Duration::from_secs(30) {
540 bail!(
541 "timed out waiting for pg_dump to open the direct virtual protocol connection"
542 );
543 }
544 }
545 Err(mpsc::RecvTimeoutError::Disconnected) => {
546 bail!("pg_dump direct virtual networking channel closed before connect")
547 }
548 }
549 }
550}
551
552#[derive(Debug)]
553struct CaptureFile {

Callers 1

dump_direct_sqlFunction · 0.85

Calls 1

elapsedMethod · 0.80

Tested by

no test coverage detected