Skip to content

v0.9.0

Latest

Choose a tag to compare

@github-actions github-actions released this 10 Nov 10:50
bf0185e

What's Changed

Added

  • Redis subscribe(..., renew_lease=True): in-flight lease renewal. Redis
    resets a PEL entry's idle time only on delivery, so a handler running longer
    than retry_on_idle_ms was reclaimed and redelivered while still running.
    • Every renew_lease_interval_ms (default retry_on_idle_ms // 3) a Lua
      script renews this consumer's in-flight entries with XCLAIM ... 0 <id> JUSTID (owner and delivery count unchanged) on the main and .retry
      stream, including prefetched ones; a crashed worker's entries are still
      reclaimed.
    • An entry reclaimed anyway cancels its handler with
      eggai.transport.LeaseLostError (cancel_on_lease_lost=False lets it
      finish); sync handlers are never interrupted, the error is raised when
      their thread returns.
    • Requires retry_on_idle_ms and Lua scripting; rejected with no_ack=True
      and AckPolicy.MANUAL. Opt-in, default behaviour unchanged.
  • Redis subscribe(..., max_processing_ms=...): handler deadline. A handler
    still running at it is cancelled with eggai.transport.ProcessingTimeoutError
    and its entry NACKed for the normal retry. Requires retry_on_idle_ms;
    rejected with no_ack=True.

Changed

  • anyio (>=4.0,<5, the range FastStream already requires) is now a
    declared dependency; the SDK imports it directly.

Fixed

  • Redis: the pending-entry reclaimer claims stale entries in bounded batches
    instead of with one XCLAIM for all of them. A consumer whose handler fails
    fast while a dependency is down accumulates a large PEL; once it went stale,
    one reclaim cycle claimed it all, loading every payload (plus a re-encoded
    copy each) into memory at once, which with large messages could exhaust the
    process. Each cycle now claims, re-queues and acks at most
    retry_reclaim_batch_size entries (new subscribe option, default 10) at a
    time before claiming the next batch. Retry counts, backoff, poison handling
    and DLQ routing are unchanged.
  • Redis: consuming resumes after a lost consumer group (stream deleted,
    Redis flushed or failed over) with FastStream >= 0.7.6, for every stream
    subscription (not only renew_lease). Those versions stop a subscriber for
    good on NOGROUP instead of retrying the read, so the group monitor
    recreated the group but nothing read from it any more. The monitor now also
    restarts the stream subscribers connect() started, once their group exists
    again (a partial loss still redelivers from id 0). A subscriber FastStream
    stops again right after a restart (an error a restart can't fix, e.g.
    min_idle_time on Redis < 6.2) is restarted with exponential backoff, up to
    5 minutes, and logged as an error. No change on FastStream <= 0.7.5, where
    the read loop never stopped. The lock moves from FastStream 0.7.5 to 0.7.7
    (it was held back for this bug), so CI covers this path.
  • A sync handler with data_type / filter_by_data / filter_by_message now
    runs in a worker thread, as FastStream (Kafka, Redis) runs a sync handler
    without those options. The filter wrapper called it on the event loop,
    blocking every other consumer, Kafka heartbeats and Redis lease renewal for
    its whole run (a long one was reclaimed and redelivered despite
    renew_lease=True). Applies to all transports.

Security

  • Lock files refreshed within the existing constraints: PyJWT 2.13.0 → 2.15.1
    and urllib3 2.7.0 → 2.8.0 (sdk and docs), clearing the open advisories on
    both.

Installation

pip install eggai==0.9.0