Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Splunk-maintained changes
from the upstream RedBeat release history below.

- Add RedBeatSchedulerEntry.save_with_first_due() to create an interval
entry with an application-selected whole-second UTC first due time.
entry with an application-selected timezone-aware first due time.
Normalize it to UTC while preserving fractional seconds in metadata.
Store its definition, run metadata, due score and policy fingerprint
together, without allowing immediate execution to bypass that time.
- Add update_definition() to change a managed entry's payload without
Expand All @@ -16,14 +17,39 @@ Splunk-maintained changes
Redis writes, changed run state and deletion. Preserve newer payloads
and immediate requests. Retry WATCH conflicts up to three total attempts.
Ordinary managed reservations do not rewrite an unchanged definition.
- Add the optional redbeat_entry_policy callback to select the following
due time and applied policy during reservation. Keep the current stored
run unchanged. Allow applications to adopt, replace or remove a policy
without adding their timing rules to RedBeat.
- Add request_run() for an application-selected managed refresh deadline.
Keep the earliest pending deadline and latest payload. Reuse the existing
immediate flag and interval metadata rather than a separate request record.
Due or overdue requests prompt selection without bypassing the due check.
- Add save_guarded() for ordinary entries that may acquire a managed policy.
Assign an entry_id on guarded creation and reject stale writes after
deletion and recreation under the same key. Keep existing legacy entries
without an identity unchanged instead of assigning one during reload.
Assign the caller's creation identity only after the Redis write succeeds.
- Raise EntryAlreadyExists, a ValueError subtype, when either creation API
finds a winning entry. First-due creation uses the same three-attempt
WATCH handling so callers can distinguish this race from invalid input.
- Store policy fingerprints and creation identities as JSON values so both
text and byte Redis responses use the same decoding path.
- Keep from_key() on the existing HGET pipeline pattern, without duplicate
identity reads or load-time retries. Remove the associated selection-error
handler and obsolete tests. Guarded writes retain their identity checks.
Non-transactional reads can still mix records during same-key replacement.
- Add unit and isolated Redis, Beat and worker integration coverage.
Cover following-run policies, managed refreshes, same-key replacement,
concurrent writes, legacy entries and Redis Cluster managed operations.
Run tests with pytest and retain Python 3.9 CI support by using Ubuntu
24.04 test runners with an explicitly installed Redis test binary.

Applications remain responsible for offset calculation and timing policy.
This PR does not add a jitter configuration flag, automatic enable/disable
transitions or other application lifecycle behavior. Entries without the
optional managed state retain their existing scheduling path.
RedBeat supplies persistence and the optional following-run policy hook,
not a jitter configuration flag or application-specific lifecycle rules.
Entries without managed state or a policy requesting adoption retain their
existing scheduling path.

2.4.2 (2026-07-27)
---------------------
Expand Down
29 changes: 29 additions & 0 deletions docs/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,32 @@ As a result most datetime objects need to be timezone aware.
due_at, returns aware datetime
to_timestamp(), accepts aware datetime, returns seconds since epoch (UTC)
score(), returns seconds since epoch for due_at

Explicit interval deadlines
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The opt-in ``save_with_first_due()`` and ``request_run()`` methods accept
timezone-aware deadlines. RedBeat converts them to UTC before calculating the
matching interval anchor. Fractional seconds in the deadline and interval are
preserved in JSON metadata. These methods require a positive, non-relative
interval schedule. Calendar schedules and relative rounding do not use this
anchor calculation. Other scheduling APIs keep their existing behavior.

The optional ``redbeat_entry_policy`` callback can select a following deadline
under the same rules. It does not move the current saved invocation. Applications
own their policy, including any jitter window, identity hashing, whole-second
rounding or exceptions for urgent work. RedBeat stores the supplied timing and
protects managed writes against concurrent updates and schedule replacement.

Redis lookup scores retain their existing whole-second precision. A candidate
can therefore be selected before a fractional deadline. The full-precision due
check still prevents early publication. Beat wake-up frequency, broker latency
and worker capacity can delay dispatch or execution. Subsecond timing is not a
real-time execution guarantee.

Entry loading follows the existing pipeline read pattern. Standalone Redis and
Sentinel use the client's default transactional pipeline. A non-transactional
read, including a default Cluster pipeline, does not guarantee a consistent
snapshot if another client deletes and recreates the same key during that read.
There is no load-time retry or duplicate identity read. Managed writes still
check the loaded creation identity and applied policy before saving.
Loading
Loading