@@ -133,6 +133,10 @@ private enum LocalLambda {
133133 }
134134
135135 func processRequest( context: ChannelHandlerContext , request: ( head: HTTPRequestHead , body: ByteBuffer ? ) ) {
136+
137+ let eventLoop = context. eventLoop
138+ let loopBoundContext = NIOLoopBound ( context, eventLoop: eventLoop)
139+
136140 switch ( request. head. method, request. head. uri) {
137141 // this endpoint is called by the client invoking the lambda
138142 case ( . POST, let url) where url. hasSuffix ( self . invocationEndpoint) :
@@ -142,6 +146,7 @@ private enum LocalLambda {
142146 let requestID = " \( DispatchTime . now ( ) . uptimeNanoseconds) " // FIXME:
143147 let promise = context. eventLoop. makePromise ( of: Response . self)
144148 promise. futureResult. whenComplete { result in
149+ let context = loopBoundContext. value
145150 switch result {
146151 case . failure( let error) :
147152 self . logger. error ( " invocation error: \( error) " )
@@ -178,6 +183,7 @@ private enum LocalLambda {
178183 // create a promise that we can fullfill when we get a new task
179184 let promise = context. eventLoop. makePromise ( of: Invocation . self)
180185 promise. futureResult. whenComplete { result in
186+ let context = loopBoundContext. value
181187 switch result {
182188 case . failure( let error) :
183189 self . logger. error ( " invocation error: \( error) " )
0 commit comments