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

Issues with multiple service decorators on the same method #125

Open
elonp opened this issue Apr 22, 2024 · 2 comments
Open

Issues with multiple service decorators on the same method #125

elonp opened this issue Apr 22, 2024 · 2 comments

Comments

@elonp
Copy link
Contributor

elonp commented Apr 22, 2024

  1. AFAIU decorating the same method with multiple group decorators is allowed. This scenario is not tested in rats.apps - I broke it in the first iterations of refactor: disallow calling service methods directly #124 and passed unit tests but broke rats-devtools.
  2. Do we allow decorating the same method with multiple service decorators too? I don't see why not, but it was not allowed in previous versions. Likewise for the rest of the decorators.
  3. The caching of service methods should move from the decorator to AnnotatedContainer.get_namespaced_group. The contract for a service is that you get the same service object in all calls for the same service id. But users should expect different objects for different service ids, regardless of whether they were defined using the same method or not.
@elonp
Copy link
Contributor Author

elonp commented Apr 22, 2024

@ms-lolo

@ms-lolo
Copy link
Collaborator

ms-lolo commented Apr 26, 2024

will think about this a little and get back to you but my first impression is that your point #3 is correct and we should allow multiple services to be tied to one provider and the caching should be based on the service id, not the provider function. but in that case, the caching expectation might belong in the Container API and not just the annotated containers, but I'm not sure if that's possible

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

No branches or pull requests

2 participants