swarm-nats-auth: answer callout requests concurrently, skip expired ones
Each request now runs in its own task, at most CONCURRENT_REQUESTS (32) at once, instead of being awaited inline by the subscription loop. A request whose exp (nats-server sets it to send time plus its authorization.timeout) has passed is skipped without a lookup or reply. Fixes #5434.
This commit is contained in:
parent
bf848ba65f
commit
6971b4e4ed
1 changed files with 334 additions and 48 deletions
|
|
@ -240,7 +240,7 @@ pub(crate) mod tests {
|
|||
let (server_key, opened) = open(&own, Some(&server.public_key()), &sealed).expect("opens");
|
||||
assert_eq!(server_key.public_key(), server.public_key());
|
||||
let req = crate::request::decode(&opened).expect("a request");
|
||||
assert_eq!(req.user_nkey, "UCLIENT");
|
||||
assert_eq!(req.nats.user_nkey, "UCLIENT");
|
||||
|
||||
let issuer = nkeys::KeyPair::new_account();
|
||||
let permissions = crate::policy::Permissions {
|
||||
|
|
@ -251,8 +251,8 @@ pub(crate) mod tests {
|
|||
let token = crate::respond::grant(
|
||||
&issuer,
|
||||
"APP",
|
||||
&req.server_id.id,
|
||||
&req.user_nkey,
|
||||
&req.nats.server_id.id,
|
||||
&req.nats.user_nkey,
|
||||
&permissions,
|
||||
None,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue