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

Skip event Lua to Rust struct conversion if there are no active event streams #44

Open
rkusa opened this issue Oct 22, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@rkusa
Copy link
Collaborator

rkusa commented Oct 22, 2021

Converting an event to a Rust struct is a costly operation (not as costly as Lua -> JSON -> Rust would be though). We should thus update the implementation to only make the conversion if necessary.

Implementation:

  • Check whether either the log level is set to debug, or if there is at least on active events stream.
  • If yes, convert the event to a struct and continue as usual
  • If no, just ignore the event
@rkusa rkusa self-assigned this Oct 22, 2021
@rurounijones
Copy link
Contributor

rurounijones commented Oct 24, 2021

The title is for event streams but the comment talks about units

Check whether either the log level is set to debug, or if there is at least on active units stream.

I am guessing we actually want this for both the unit and event streams? (and the hook env chat stream)?

@rkusa
Copy link
Collaborator Author

rkusa commented Oct 25, 2021

Oops, you are right, I've updated the issue (to talk about the event stream) 👍 . This is only relevant for the events stream. The units stream is polling based, so there is no unit pushed to the server if there are no active streams and the message stream isn't deserializing a Lua table to a Rust struct (just takes a string).

@rurounijones rurounijones added the enhancement New feature or request label May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants