Skip to content

Commit e3d7079

Browse files
authored
Add Lambda-Runtime-Deadline-Ms response header (#1998)
1 parent 016b174 commit e3d7079

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "Amazon.Lambda.TestTool",
5+
"Type": "Patch",
6+
"ChangelogMessages": [
7+
"Add Lambda-Runtime-Deadline-Ms response header"
8+
]
9+
}
10+
]
11+
}

Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Services/LambdaRuntimeAPI.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ public async Task GetNextInvocation(HttpContext ctx, string functionName)
145145
Console.WriteLine(HeaderBreak);
146146
Console.WriteLine($"Next invocation returned: {activeEvent.AwsRequestId}");
147147

148+
// Set the deadline to the Lambda max length of 15 minutes. Formatted as Epoch MS.
149+
long deadline = ((long)(DateTime.UtcNow.AddMinutes(15) - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds);
150+
ctx.Response.Headers["Lambda-Runtime-Deadline-Ms"] = deadline.ToString();
148151

149152
ctx.Response.Headers["Lambda-Runtime-Aws-Request-Id"] = activeEvent.AwsRequestId;
150153
ctx.Response.Headers["Lambda-Runtime-Trace-Id"] = Guid.NewGuid().ToString();

0 commit comments

Comments
 (0)