@@ -133,6 +133,10 @@ private enum LocalLambda {
133
133
}
134
134
135
135
func processRequest( context: ChannelHandlerContext , request: ( head: HTTPRequestHead , body: ByteBuffer ? ) ) {
136
+
137
+ let eventLoop = context. eventLoop
138
+ let loopBoundContext = NIOLoopBound ( context, eventLoop: eventLoop)
139
+
136
140
switch ( request. head. method, request. head. uri) {
137
141
// this endpoint is called by the client invoking the lambda
138
142
case ( . POST, let url) where url. hasSuffix ( self . invocationEndpoint) :
@@ -142,6 +146,7 @@ private enum LocalLambda {
142
146
let requestID = " \( DispatchTime . now ( ) . uptimeNanoseconds) " // FIXME:
143
147
let promise = context. eventLoop. makePromise ( of: Response . self)
144
148
promise. futureResult. whenComplete { result in
149
+ let context = loopBoundContext. value
145
150
switch result {
146
151
case . failure( let error) :
147
152
self . logger. error ( " invocation error: \( error) " )
@@ -178,6 +183,7 @@ private enum LocalLambda {
178
183
// create a promise that we can fullfill when we get a new task
179
184
let promise = context. eventLoop. makePromise ( of: Invocation . self)
180
185
promise. futureResult. whenComplete { result in
186
+ let context = loopBoundContext. value
181
187
switch result {
182
188
case . failure( let error) :
183
189
self . logger. error ( " invocation error: \( error) " )
0 commit comments