~/docs
Resonate
Resonate
1.x 1.8.1.4, current
Fledge Pulse
Toggle sidebar
Fledge Pulse
webpatser/fledge-pulse 1.8.1.4

Fledge Pulse 1.x

What Is Different

What Fledge Pulse changes compared to Laravel Pulse, taken from the repository's README and Fledge changelog.

Fledge Pulse is based on Laravel Pulse v1.8.1. Besides composer.json, exactly two upstream runtime files are edited: src/Support/PulseMigration.php and src/Recorders/Concerns/Sampling.php. Everything else is an overlay under src/Fiber/.

Storage driver registry

Upstream always binds DatabaseStorage, whatever pulse.storage.driver says. Here StorageManager resolves the driver and the default is database (FiberDatabaseStorage). Packages and applications register drivers with extend; see Examples.

FiberDatabaseStorage is fiber-safe on every supported connection:

  • Shared PDO (plain mariadb, mysql, pgsql, sqlite, fledge-mariadb, ...): one PDO serves every fiber. Each storage operation (store with its transaction, trim, purge and every read, including fully reading the result set) runs under a per-connection LocalMutex, so parallel cards take turns instead of failing with "stream is in use by another fiber", unbuffered-query errors or "already an active transaction". Correct, but sequential.

Warning: The lock is reentrant within one fiber. Do not start a child fiber with async() and await it from inside a storage call on the same shared connection: the child would wait for the lock its parent holds.

Fiber guarantees

  • Dialect by connection class. FiberDatabaseStorage picks its upsert SQL from the connection class (MySQL family, Postgres, SQLite), not from getDriverName().
  • Fiber-scoped ignore(). Pulse::ignore() keeps a depth per fiber instead of saving and restoring one shared flag, so overlapping cards can no longer leave recording switched off. The depth is not inherited by child fibers started with Fledge\Async\async() inside the callback; wrap those closures in ignore() too if they must not record.
  • Ingest swaps buffers before I/O. ingest() takes the entries and lazy resolvers out of the live buffers before it suspends, so anything recorded meanwhile is ingested next time instead of being flushed away.
  • One buffer-size ingest at a time. When the buffer grows past pulse.ingest.buffer, one fiber ingests. Fibers that record while that ingest is in flight return immediately; their entries go into the next ingest.
  • Fledge Redis ingest. With REDIS_CLIENT=fledge, the Redis ingest runs through FledgeRedisConnection. Upstream's RedisAdapter is typed for PhpRedis, Predis and Relay, so on a Fledge connection it throws and Pulse's error handling swallows it: nothing gets recorded.
  • No blocking sleeps. pulse:work and pulse:check wait through Laravel\Pulse\Fiber\Support\FiberSleep, a Sleep subclass that waits with Fledge\Async\delay(), so they yield to other fibers. Sleep::fake() still works in tests. Digest and trim stay sequential.
  • rememberMany. Cards can use Laravel\Pulse\Fiber\Livewire\Concerns\RemembersConcurrently to remember several queries at once. Cache hits are returned as is; only the misses run, concurrently, through FiberDB::concurrent. It shares cache keys and TTL with remember(). On a shared PDO the storage lock serializes the queries, so it is safe but no faster than calling remember() in a row.

Redis pipeline

Since v1.8.1.3, FledgeRedisAdapter::pipeline() runs on a bounded pool of fibers: at most 256 worker fibers (a fixed bound, not configurable) drain the queue and enqueue commands on the link in queue order, so stream entries keep their insertion order. Every queued command still runs when an earlier one fails; the error of the first failing command in queue order is thrown afterwards. Up to 256 commands are in flight at once, so a batch of that size or smaller is one round trip and a larger one takes about ceil(N / 256). Stock Pulse has no fiber pipeline.

The upstream files edited

  • src/Support/PulseMigration.php decided whether a migration should run by matching getDriverName() against mariadb, mysql, pgsql and sqlite, which rejected connections with other driver names. It now checks the connection class instead.
  • src/Recorders/Concerns/Sampling.php turned the whole 32-digit md5 of the seed into a number with hexdec(). That overflows PHP_INT_MAX, which PHP 8.6 reports as a notice, so deterministic sampling (the queues and slow jobs recorders) threw under Laravel's error handler. It now scales the first 13 hex digits (52 bits) by 16^13. Over 100,000 random seeds the sampling decision matched the previous implementation at every rate tested (0.001, 0.01, 0.1, 0.5, 0.9).

The test setup is touched too: phpunit.xml.dist gains a Fiber testsuite, tests/Pest.php applies the shared test case to tests/Fiber, and tests/Feature/RedisTest.php no longer runs redis-cli FLUSHALL before every test; each test uses its own random key prefix and deletes only the keys under it.

Release history

Version Date Change
v1.8.1.4 2026-11-23 Requires PHP 8.6 (breaking); fledge-fiber and fledge-framework ^13.43.0.3; fixes deterministic sampling on PHP 8.6
v1.8.1.3 2026-11-18 Bounded fiber pool in the Fledge Redis pipeline
v1.8.1.2 2026-10-24 Requires livewire/livewire ^4.4.8 (GHSA-mhf7-xp6r-6qrc)
v1.8.1.1 2026-10-22 Requires fledge-fiber and fledge-framework ^13.38
v1.8.1.0 2026-10-14 First Fledge release, a fork of Laravel Pulse v1.8.1