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

Fixed exceptions in C# SDK when someone disconnects or when a transaction originates from CLI #1461

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

SteveBoytsun
Copy link
Contributor

Trivial

Description of Changes

  • Added two cases to code gen switch that parses args based on reducer name
    • "identity_disconnected" - another client disconnects
    • "" (empty string) - when calling UPDATE / DELETE from CLI

Expected complexity level and risk

Complexity: 1/5
Risk: 1/5

This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.

Testing

Describe any testing you've done, and any testing you'd like your reviewers to do,
so that you're confident that all the changes work as expected!

  • Re-generate C# code with this change
  • Open "main" client and connect to server
  • Have another client connect to same server
  • Close another client. Note there is no exception logged in "main" client
  • Open CLI and run an UPDATE / DELETE query. Note there are no exceptions logged in "main" client

@@ -712,6 +712,8 @@ pub fn autogen_csharp_globals(items: &[GenItem], namespace: &str) -> Vec<(String
);
}
writeln!(output, "\"<none>\" => null,");
writeln!(output, "\"__identity_disconnected__\" => null,");
Copy link
Collaborator

Choose a reason for hiding this comment

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

why only __identity_disconnected__ here and not also __identity_connected__?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it

Copy link
Member

Choose a reason for hiding this comment

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

FWIW in modules we treat all events that start with __ and end with __ as "special" in various places.

Could do the same here instead of hardcoding a few names.

Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

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

IMO We should allow users to subscribe to these events instead of just suppressing the errors here, I've created an issue in the C# SDK: clockworklabs/com.clockworklabs.spacetimedbsdk#102

I can understand the BitCraft team not wanting to have to deal with these errors as they're doing development on the game so I'm fine to approve this as-is for now.

@SteveBoytsun SteveBoytsun added this pull request to the merge queue Jun 26, 2024
Merged via the queue into master with commit 81085b0 Jun 26, 2024
7 checks passed
bfops pushed a commit that referenced this pull request Jun 26, 2024
…C# SDK when someone disconnects or when a transaction originates from CLI

Co-authored-by: Steve Boytsun <[email protected]>
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.

3 participants