Skip to content

Commit eddf4c5

Browse files
committed
chore: fmt
1 parent e03fa42 commit eddf4c5

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

lambda-runtime/src/layers/api_response.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
use crate::{
2-
Diagnostic, EventErrorRequest, IntoFunctionResponse, LambdaEvent, constants::LAMBDA_RUNTIME_INVOCATION_ID, deserializer, rate_limiter::RateLimiter, requests::{EventCompletionRequest, IntoRequest}, runtime::LambdaInvocation,
2+
constants::LAMBDA_RUNTIME_INVOCATION_ID,
3+
deserializer,
4+
rate_limiter::RateLimiter,
5+
requests::{EventCompletionRequest, IntoRequest},
6+
runtime::LambdaInvocation,
7+
Diagnostic, EventErrorRequest, IntoFunctionResponse, LambdaEvent,
38
};
49
use futures::{ready, Stream};
510
use lambda_runtime_api_client::{body::Body, BoxError};
@@ -9,7 +14,6 @@ use std::{fmt::Debug, future::Future, marker::PhantomData, pin::Pin, task, time:
914
use tower::Service;
1015
use tracing::{error, trace, warn};
1116

12-
1317
static MALFORMED_INVOCATION_ID_LIMITER: RateLimiter = RateLimiter::new(Duration::from_secs(60));
1418

1519
/// Tower service that turns the result or an error of a handler function into a Lambda Runtime API
@@ -132,7 +136,6 @@ where
132136
Some(value) => match value.to_str() {
133137
Ok(value) => Some(value.to_owned()),
134138
Err(error) => {
135-
136139
if MALFORMED_INVOCATION_ID_LIMITER.allow() {
137140
warn!(
138141
error = ?error,

lambda-runtime/src/rate_limiter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ impl RateLimiter {
6666
#[cfg(test)]
6767
mod tests {
6868
use super::*;
69-
use std::panic::{catch_unwind, AssertUnwindSafe};
70-
use std::thread;
69+
use std::{
70+
panic::{catch_unwind, AssertUnwindSafe},
71+
thread,
72+
};
7173

7274
#[test]
7375
fn allows_first_call() {

test/dockerized/scenarios/concurrent_scenarios.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
"""
2-
Multi-concurrency test scenarios for basic-lambda-concurrent.
3-
4-
The handler expects: { "command": "<string>" }
5-
and responds with: { "req_id": "<id>", "msg": "Command <command> executed." }
6-
"""
1+
"""Multi-concurrency test scenarios."""
72

83
import os
9-
from containerized_test_runner.models import Request, ConcurrentTest
4+
from containerized_test_runner.models import ConcurrentTest, Request
105

116
HANDLER = "basic-lambda-concurrent"
127
INVOCATION_ID_HANDLER = "invocation-id-concurrent"
@@ -16,16 +11,20 @@
1611
TIMEOUT = 5
1712

1813

19-
def _make_env(concurrency: int = DEFAULT_CONCURRENCY) -> dict:
14+
def _make_env(handler: str = HANDLER, concurrency: int = DEFAULT_CONCURRENCY) -> dict:
2015
return {
21-
"_HANDLER": HANDLER,
16+
"_HANDLER": handler,
2217
"AWS_LAMBDA_MAX_CONCURRENCY": str(concurrency),
2318
"AWS_LAMBDA_LOG_FORMAT": "JSON",
2419
}
2520

2621

27-
def _invocation_id_env(concurrency: int = DEFAULT_CONCURRENCY, timeout: int = TIMEOUT) -> dict:
28-
return _make_env(concurrency) | {
22+
def _invocation_id_env(
23+
handler: str = INVOCATION_ID_HANDLER,
24+
concurrency: int = DEFAULT_CONCURRENCY,
25+
timeout: int = TIMEOUT,
26+
) -> dict:
27+
return _make_env(handler, concurrency) | {
2928
"AWS_LAMBDA_FUNCTION_TIMEOUT": str(timeout),
3029
}
3130

@@ -91,7 +90,7 @@ def get_invocation_id_scenarios():
9190
return [ConcurrentTest(
9291
name="invocation_id",
9392
handler=INVOCATION_ID_HANDLER,
94-
environment_variables=_invocation_id_env(timeout=TIMEOUT),
93+
environment_variables=_invocation_id_env(handler=INVOCATION_ID_HANDLER, timeout=TIMEOUT),
9594
request_batches=batches,
9695
image=IMAGE,
9796
)]

0 commit comments

Comments
 (0)