Repository navigation
feat: Add reusable event dispatch and delivery - #1
Merged
Merged
Conversation
Code Review SummaryThe package adds event envelopes and isolated event buses with ordered, wildcard, contextual, synchronous, and asynchronous listener dispatch. Optional jobs integration serializes events for queued delivery, while signed HTTP provides a configurable outbound transport; queueing can use caller transaction context, and worker listener failures request retries. 🚀 Key Improvements
|
| raise ValueError("An event requires an identifier") | ||
| if not isinstance(self.data, Mapping) or not isinstance(self.metadata, Mapping): | ||
| raise ValueError("Event data and metadata must be mappings") | ||
| if ( |
There was a problem hiding this comment.
A tzinfo object can be present while utcoffset() returns None, which means Python treats the datetime as naive. Such an event is accepted, then to_dict() converts it using the machine’s local timezone and can emit the wrong occurrence time; also reject datetimes whose utcoffset() is None.
Suggested change
| if ( | |
| if ( | |
| not isinstance(self.occurred_at, datetime) | |
| or self.occurred_at.tzinfo is None | |
| or self.occurred_at.utcoffset() is None | |
| ): | |
| raise ValueError("An event requires a timezone-aware occurrence time") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add reusable events and listeners for Python applications. Queue delivery through jobs so events can commit with application state.