unkeyed / unkey

Open source API management platform

Home Page:https://go.unkey.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rootkeys API keys take long to create

Flo4604 opened this issue · comments

commented

Preliminary Checks

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)
commented

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:
46569
14720

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.

Thanks for opening the issue @Flo4604 I just assigned it to you just so no one else works on it as I know you have a PR 🙇