-
Notifications
You must be signed in to change notification settings - Fork 12
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
WIP #4
WIP #4
Conversation
Out of curiosity, what do you see as the risks of doing harm? I don't mind updating the list of classes occasionally, but I can basically guarantee I'm going to forgot to add new ones sometimes. Re: the region value check, I'm fine removing it, but I'd like to keep the enum column for the multi-seller setup. If someone using the library wants to modify the migration when they publish it, they're welcome to, but that constraint prevents accidentally adding bad endpoints. I made some minor comments – if you wouldn't mind addressing those and running |
Well harm is maybe a bit too much. What I mean is that what the ClassFinder library is actually not as easy as it looks. It might involve filesystem operations which is potentially very slow - as we noticed. So without a solid caching mechanism it will just be too slow for many usecases. Also a service provider is one of the worst places for slow code.
Not yet deleted and will leave as is.
Yes I'll see that I can make the discussed changes within the next days. |
I just made the SP API classes listed explicitly. Once those revisions are ready and the conflicts are merged from that update, should be good to go :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple tiny comments, once those are addressed this'll be ready to merge :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, looking good. Thanks!
Hi,
this PR addresses some issues discussed in #2 and #3.
I decided against caching the classes and against putting the class finding logic in the config as well. I think having the service provider implement the DeferrableProvider interface as is, is already enough to reduce the performance impact in production environments. I had previously overlooked this.
I could verify that when the DeferrableProvider interface is added, the ServiceProvider is neither created nor registered or booted on normal HTTP requests. Also a robust caching mechanism which ensures that the classes are up to date at all times is not that simple to implement.
I would vote for listing all the API classes explicitly as well. The auto-discovery "feature" does not provide any benefit for the user, but has a high risk of doing harm. It only saves the package maintainer a few minutes ;)
I also removed the region check to be able to use EU_SANDBOX during tests. I still don't really see why this check is needed except because the region db column for the multiseller setup is defined like this:
If we changed this, we could probably remove the REGIONS constant in SellingPartnerApi (
public const REGIONS = ['NA', 'EU', 'FE'];
) completely.