Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One event class and Event Broker config extension #60

Merged
merged 4 commits into from Aug 5, 2022
Merged

Conversation

pdyba
Copy link
Owner

@pdyba pdyba commented Aug 4, 2022

No description provided.

Piotr Dyba added 2 commits August 4, 2022 12:55
…using for asynchronous communication between services: BaseEvent and Event. After implementing them, it turned out that they are very similar and it is possible to use only one instead.

The biggest benefit is simplicity as having one class is always easier to understand/use.
setup.cfg Outdated Show resolved Hide resolved
lbz/events/event.py Outdated Show resolved Hide resolved
return False

def __repr__(self) -> str:
return f"Event(type='{self.type}', data={self.data})"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most events, self.data won't be small - I don't know if putting it into the representation makes sense 😉

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there out of the box in the original data class.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that does not mean it was good, dataclass puts there everything by default, I think.

If we need to present data, still, we can do this but I would like to keep representation clearer 😉

tests/test_events/test_event.py Outdated Show resolved Hide resolved
lbz/events/api.py Outdated Show resolved Hide resolved
lbz/events/broker.py Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Aug 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@pdyba pdyba merged commit 0b23eb1 into master Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants