Skip to content

Hi @abuzuhri, thanks for providing the rate limiting. But it looks like I am still getting throttled on this particular function: #178

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

Closed
abuzuhri opened this issue May 5, 2022 · 13 comments

Comments

@abuzuhri
Copy link
Owner

abuzuhri commented May 5, 2022

Hi @abuzuhri, thanks for providing the rate limiting. But it looks like I am still getting throttled on this particular function:
connection.CatalogItem.ListCatalogItemsAsync().
I am getting "You exceeded your quota for the requested resource." error after about 30 requests. I tried to rate limit myself to 1 request per second and still getting it even though the rate is supposed to be 5 times per second. Any ideas?

It's a little hard to debug since the rate limit header is not exposed by the library.

Originally posted by @igoryan-k in #109 (comment)

@abuzuhri
Copy link
Owner Author

abuzuhri commented May 5, 2022

If you change the setting to IsActiveLimitRate = false then the application will not handling the limit

AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
            {
                ..
                IsActiveLimitRate = false
            });

I do test for this method and it look like it working perfect
image

@abuzuhri
Copy link
Owner Author

abuzuhri commented May 5, 2022

@igoryan-k please recheck if you have another instance running in different server that take the limit or you share the Keys with another ...

@abuzuhri
Copy link
Owner Author

abuzuhri commented May 7, 2022

@TechyChap share this code that working perfectly with him in .net core

services.AddSingleton(c => new AmazonConnection(new AmazonCredential()
{
AccessKey = settings.AccessKey,
SecretKey = settings.SecretKey,
RoleArn = settings.RoleArn,
ClientId = settings.ClientId,
ClientSecret = settings.ClientSecret,
RefreshToken = settings.RefreshToken,
MarketPlace = MarketPlace.UnitedKingdom,
Environment = settings.UseSandbox ? Constants.Environments.Sandbox : Constants.Environments.Production
}));

In case you use unit testing better to use wrapper to mock method you need

public class AmazonListingService : IAmazonListingService
    {
        private readonly AmazonConnection _connection;

        public AmazonListingService(AmazonConnection connection)
        {
            _connection = connection;
        }

        public async Task<ListingsItemSubmissionResponse> PutListingsItemAsync(ParameterPutListingItem listing)
        {
            return await _connection.ListingsItem.PutListingsItemAsync(listing);
        }
    } 

@rcalv002
Copy link

This is essentially what I use as well and still have issues. A drawback of this singleton is that changes to the settings would require application restart, right?

@TechyChap
Copy link
Contributor

If you are changing settings then perhaps something like IOptionsMonitor might work - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-6.0

I need to support multiple market places so my plan is to implement multiple connections, one for each marketplace. So won't be changing parameters once created. Not written the code for that yet but will likely be using a named instance.

https://stackoverflow.com/questions/39174989/how-to-register-multiple-implementations-of-the-same-interface-in-asp-net-core

@abuzuhri
Copy link
Owner Author

@rcalv002 are you still facing problem ?

@rcalv002
Copy link

@rcalv002 are you still facing problem ?

Yes indeed

@rcalv002
Copy link

rcalv002 commented Oct 11, 2022 via email

@abuzuhri
Copy link
Owner Author

Do you try last version we fix that

@rcalv002
Copy link

Hi abuzuhri I havent tried in a while, Actually I didn't respond 6 hours ago.. very strange.

@ProNotion
Copy link
Contributor

I am currently getting this for requests that are made to the /fba/inventory/v1/summaries endpoint.

@RenzoF
Copy link
Collaborator

RenzoF commented Nov 3, 2022

@ProNotion have you got multiple instances running at the same time? or do you restart the application every time it runs?
The Throttle info is per instance, I have separate workers calling the API so I had to do a workaround to save the Throttle details in a file, ideally, we should split this into a database so that it can scale.

@ProNotion
Copy link
Contributor

Only 1 instance but during development it is regularly restarted so perhaps that is the cause. I agree with the scalability of it needing to be addressed somehow.

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

5 participants