-
Notifications
You must be signed in to change notification settings - Fork 113
Add Deadline #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Deadline #27
Conversation
7a679c9
to
3f49f3b
Compare
Sources/SwiftAwsLambda/Lambda.swift
Outdated
public let logger: Logger | ||
|
||
internal init(requestId: String, | ||
traceId: String, | ||
invokedFunctionArn: String, | ||
deadline: String, | ||
deadline: Int64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we used DispatchWallTime
instead of Int64? we can compute it in a similar way to getRemainingTime
below, ie with a timespec
: https://developer.apple.com/documentation/dispatch/dispatchwalltime/2300027-init
this way we can get rid of getRemainingTime
and users (or the library) can compare deadline to DispatchWallTime.now etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to get it to work, but I still have no idea how to convert into the Unix epoch time. If you have a solution for this I’m glad to take it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabianfett added a commit with a proposal. feel free to revert it if you prefer the other way. also feel free to rename things, I dont love the names I picked
764dc5d
to
820b4da
Compare
41c4c16
to
7020c2a
Compare
Motivation: - As a developer I want to be able to know how much time I have left to execute my lambda, before it times out Changes: - storing the deadline as Int64 on Context and Invocation - added getRemainingTime() to Context which returns a TimeAmount - in the FoundationCompat library we should offer something based on Date - fixed MockLambdaServer to not return “keep-alive” anymore
- Renamed `Invocation.deadline` to `Invocation.deadlineInMillisSinceEpoch` to better reflect meaning. - Added a test for `Context.getRemainingTime()`
7020c2a
to
3450478
Compare
Added |
you can run the |
Motivation:
Changes:
Context
andInvocation
getRemainingTime()
toContext
which returns aNIO.TimeAmount
FoundationCompat
library we should offer something based onDate
“keep-alive”
anymoreInvocation.deadlineDate
toInvocation.deadline
This fixes #9