- Fix YAML tags in auth config struct (json -> yaml) - Update CLI configs to use pre-hashed API keys - Remove double hashing in WebSocket client - Fix port mapping (9102 -> 9103) in CLI commands - Update permission keys to use jobs:read, jobs:create, etc. - Clean up all debug logging from CLI and server - All user roles now authenticate correctly: * Admin: Can queue jobs and see all jobs * Researcher: Can queue jobs and see own jobs * Analyst: Can see status (read-only access) Multi-user authentication is now fully functional.
28 lines
679 B
Go
28 lines
679 B
Go
package controller
|
|
|
|
// AdaptivePacingController derives request pacing based on worker capacity.
|
|
type AdaptivePacingController struct {
|
|
DesiredRPSPerWorker int
|
|
}
|
|
|
|
// NewAdaptivePacingController constructs a controller with sane defaults.
|
|
func NewAdaptivePacingController(desired int) AdaptivePacingController {
|
|
if desired < 1 {
|
|
desired = 1
|
|
}
|
|
return AdaptivePacingController{DesiredRPSPerWorker: desired}
|
|
}
|
|
|
|
// RequestsPerSec returns max(1, maxWorkers * desiredRPSPerWorker).
|
|
func (a AdaptivePacingController) RequestsPerSec(maxWorkers int) int {
|
|
if maxWorkers < 1 {
|
|
maxWorkers = 1
|
|
}
|
|
|
|
rps := maxWorkers * a.DesiredRPSPerWorker
|
|
if rps < 1 {
|
|
rps = 1
|
|
}
|
|
|
|
return rps
|
|
}
|