mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
Every Actions runner RPC (`FetchTask` polling, `UpdateTask`, `UpdateLog`, ...) goes through the `withRunner` interceptor, which verifies the runner token with PBKDF2 (`auth_model.HashToken`, ~2 ms). In a 60s CPU profile of a production instance with many runners, this accounted for ~49% of all CPU samples. - Cache successful verifications in a dedicated LRU of up to 10000 runners, keyed by the stored salt and hash and holding only a SHA-256 digest of the token. A hit costs ~100 ns. - The runner is still loaded from the DB on every RPC and failures are never cached, so deleted runners and wrong tokens never pass. - The shared `auth_model.TokenCache` is not used because its default 20 entries miss on every poll once more runners poll in turn. --------- Co-authored-by: silverwind <me@silverwind.io>