Open b0lle opened 3 days ago
Thank you for opening this issue!
🔔 @victor-falcon @Hodglim @JonathanWbn @gebeto @momme-rtf @duboiss @hexpl0it @crisboarna @sidhant92 @DorukAkinci @frese @nagauta @vineus @jfkisafk @srikirank you might want to have a look.
It already has the throttle defined here:
This should slow down the requests, are you still receiving throttles?
yes I face them regularly. Maybe we can increase the throttling time?
Hey @b0lle , since you're a contributor and might have more secrets in your account than I do for testing, can you please try fixing this? I think the problem is coming from the multiple async calls here:
Here is the refactoring I would suggest for useSecrets(string)
:
export const useSecrets = (search: string) => {
const {
data: secrets,
error,
isLoading,
revalidate,
pagination,
} = useCachedPromise(
async (query: string) => {
const { SecretList } = await new SecretsManagerClient({}).send(
new ListSecretsCommand({
NextToken: cursor,
MaxResults: 100,
...(query.trim().length > 2 && { Filters: [{ Key: "all", Values: [search] }] }),
}),
);
return secretList;
},
[search],
{ execute: isReadyToFetch() },
);
The reason being we don't need to paginate the result of an already typeahead supported api call. Plus raycast native pagination makes 2 initial calls to the promise for some reason, instead of just one.
Then, we can make corresponding changes to the command List
key and metadata (remove resource policy). I think we can add a separate action to display resource policy (as Detail view), just like we do with secret value
That way we can load the resource policy (make the api call) when user triggers the action and not during initial list rendering for all secrets. Try these changes and see if the throttling goes away.
@raycastbot assign me
thanks, I would have done it but glad you already implemented something
Extension
https://www.raycast.com/Falcon/aws
Description
Hey,
the secrets manager command should have a debounce function to avoid api requests on each keystroke. I find myself in the situation that i regularly got throttling exceptions because of too many requests. Also it would be nice to add the keywords property to the list item by splitting the secret name on -,_,/,|,\= to make search more user friendly
Who will benefit from this feature?
No response
Anything else?
No response