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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let users specify their own message priority type instead of u32 (#85) #92

Open
Restioson opened this issue Jun 21, 2022 · 6 comments
Open
Labels
enhancement New feature or request

Comments

@Restioson
Copy link
Owner

No description provided.

@Restioson Restioson added the enhancement New feature or request label Jun 21, 2022
@thomaseizinger
Copy link
Collaborator

Why is u32 not good enough? Are you thinking of custom priorities with enums?

A potential downside of more type parameters might be increased compile-times, plus such a type may have to be carried through extension libraries of xtra, depending on how they extend things.

u32 might even be a bit much for priority, perhaps u8 is enough?

@Restioson
Copy link
Owner Author

Why is u32 not good enough? Are you thinking of custom priorities with enums?

Yes, this is what I was thinking. It might be a bit easier to reason about

u32 might even be a bit much for priority, perhaps u8 is enough?

That's true, but maybe it's better for now to err on the side of more rather than less?

@thomaseizinger
Copy link
Collaborator

Why is u32 not good enough? Are you thinking of custom priorities with enums?

Yes, this is what I was thinking. It might be a bit easier to reason about

We could go the same route as logging levels here and simply provide a fixed set of priorities:

  • Minimal
  • Low
  • Default
  • High
  • Asap

@thomaseizinger
Copy link
Collaborator

thomaseizinger commented Jul 12, 2022

An advantage of a fixed set of priorities would be that we can guarantee FIFO across a single priority because we can implement it by just having one queue per priority instead of a heap and therefore not mix messages of different priorities into one data structure.

What do you think of that? I quite like the simplicity of having only "low", "default" and "high" priority messages.

@Restioson
Copy link
Owner Author

That's true. I mostly worry about the flexibility concerns here.

@thomaseizinger
Copy link
Collaborator

That's true. I mostly worry about the flexibility concerns here.

Yeah I can see that. Given how much it could simplify internally, what do you think of trimming the feature down initially and see if someone complains about the lack of more priorities?

Even if we start with low, default and high, we can always add 1-2 more before having to switch conceptually.

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