保存认证容量保护整改检查点待远程复审
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-17 12:00:45 +08:00
1 parent 0177de8a9f
commit b4f5f51c0e
27 files changed
+721 -53

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
package password
import "errors"
var ErrBusy = errors.New("password computation is busy")
// 所有协议和恢复流程共享一个计算名额;满载立即拒绝,不积压等待请求。
var computationSlot = make(chan struct{}, 1)
func acquireComputation() (func(), error) {
select {
case computationSlot <- struct{}{}:
return func() { <-computationSlot }, nil
default:
return nil, ErrBusy
}
}