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

feat(torii-grpc): add events subscription #2065

Merged
merged 13 commits into from
Jun 21, 2024

Conversation

Larkooo
Copy link
Collaborator

@Larkooo Larkooo commented Jun 14, 2024

adds events subscription #2064

Copy link

codecov bot commented Jun 17, 2024

Codecov Report

Attention: Patch coverage is 7.29167% with 178 lines in your changes missing coverage. Please review.

Project coverage is 68.34%. Comparing base (fc44c36) to head (35432c7).
Report is 4 commits behind head on main.

Current head 35432c7 differs from pull request most recent head eefb81e

Please upload reports for the commit eefb81e to get more accurate results.

Files Patch % Lines
...rates/torii/grpc/src/server/subscriptions/event.rs 12.67% 62 Missing ⚠️
crates/torii/grpc/src/server/mod.rs 10.63% 42 Missing ⚠️
crates/torii/grpc/src/client.rs 0.00% 31 Missing ⚠️
crates/torii/grpc/src/types/mod.rs 0.00% 26 Missing ⚠️
crates/torii/client/src/client/mod.rs 0.00% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2065      +/-   ##
==========================================
- Coverage   68.89%   68.34%   -0.56%     
==========================================
  Files         326      327       +1     
  Lines       40793    41128     +335     
==========================================
+ Hits        28104    28107       +3     
- Misses      12689    13021     +332     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Larkooo Larkooo marked this pull request as ready for review June 17, 2024 17:44
@glihm glihm linked an issue Jun 19, 2024 that may be closed by this pull request
crates/torii/grpc/src/server/subscriptions/event.rs Outdated Show resolved Hide resolved
crates/torii/grpc/src/server/subscriptions/event.rs Outdated Show resolved Hide resolved
crates/torii/grpc/src/server/subscriptions/event.rs Outdated Show resolved Hide resolved
crates/torii/grpc/src/server/mod.rs Outdated Show resolved Hide resolved

for (idx, sub) in subs.subscribers.read().await.iter() {
// publish all updates if ids is empty or only ids that are subscribed to
if sub.keys.is_empty() || keys.starts_with(&sub.keys) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess that's the most common operation on regular event, we just want a sub-array from the beginning. We may update this later if needed.

We may document the behavior though, to ensure the user can understand the clause. I'll add an issue on the dojo-book to ensure that we describe better what's available and how. :)

Thanks for the work done here mate!

@Larkooo Larkooo merged commit 45fa7dc into dojoengine:main Jun 21, 2024
13 checks passed
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.

Add event subscription
2 participants