Rootkeys API keys take long to create
Flo4604 opened this issue · comments
Preliminary Checks
-
I have reviewed the documentation: https://unkey.com/docs
-
I have searched for existing issues: https://github.com/unkeyed/unkey/issues
-
This issue is not a question, general help request, or anything other than a bug report directly related to Unkey. Please ask questions in our Discord community: https://unkey.com/discord.
Reproduction / Replay Link (Optional)
No response
Issue Summary
Creating a rootkey can take a very long time, in this case 16seconds.
The more permissions the longer it takes
CleanShot.2024-07-22.at.19.27.30.mp4
Steps to Reproduce
Create a rootkey with as many permissions selected as possible.
Expected behavior
It takes less time
Other information
No response
Screenshots
No response
Version info
- OS: 15.0 Beta (24A5289h)
I just added this ticket for tracking purposes, as I've already worked on a PR for this.
The most obvious issue for me seems to be this code in the createRootKey code:
It loops over each selected permission, and does a single query which is unnecessary overhead, also ingests audit logs one by one instead of batching them all at the same time.