DBIO-MySQL-EV

 view release on metacpan or  search on metacpan

t/13-async-e2e.t  view on Meta::CPAN

    '*',
    { -and => [
        { label => 'row-7' },
        \"SLEEP(0.05) = 0",
      ]
    },
  );

  isa_ok $f, 'Future', 'select_async returns a Future';

  # THIS is the assertion that defines async-ness. If the call blocked
  # waiting for the DB, $f->is_ready would already be true here.
  ok !$f->is_ready,
    'Future is PENDING the instant select_async returns '
    . '(proves the call did not block on the DB)';

  # Now drive the event loop until it settles. Timeout bumped from 500 to
  # 5000 to give the SLEEP-injected query headroom under load.
  pump_until(sub { $f->is_ready }, 5000);

  ok $f->is_ready, 'Future resolves after EV::run drives the EV::MariaDB callback';

t/13-async-e2e.t  view on Meta::CPAN

          { label => "row-$i" },
          \"SLEEP(0.05) = 0",
        ]
      },
    );
  }

  ok scalar(@futures) == $N, "issued $N facade select_async calls";

  # EVERY Future must be pending right now. If the driver accidentally
  # serialized or blocked, some/all would already be ready.
  my @pending = grep { !$_->is_ready } @futures;
  is scalar(@pending), $N,
    "all $N Futures are PENDING before any EV::run "
    . '(proves the facade does not serialize via blocking)';

  # Drive EV::run until ALL are ready. Timeout bumped to 5000: with
  # 50ms SLEEP on each conn, 16 in-flight on 16 pool conns should drain
  # in roughly 50ms — give 100x headroom for pool contention or future
  # refactors that serialize any of the acquires.
  pump_until(sub { !grep { !$_->is_ready } @futures }, 5000);



( run in 1.494 second using v1.01-cache-2.11-cpan-800906f7e73 )