Skip to content

Commit 2346094

Browse files
committed
Fixed pr notes.
1 parent 4cc896e commit 2346094

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sources/AWSLambdaRuntimeCore/Lambda.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public enum Lambda {
101101
var logger = Logger(label: "Lambda")
102102
logger.logLevel = configuration.general.logLevel
103103

104-
var r: Result<Int, Error>?
104+
var result: Result<Int, Error>!
105105
MultiThreadedEventLoopGroup.withCurrentThreadAsEventLoop { eventLoop in
106106
let lifecycle = Lifecycle(eventLoop: eventLoop, logger: logger, configuration: configuration, factory: factory)
107107
let signalSource = trap(signal: configuration.lifecycle.stopSignal) { signal in
@@ -112,18 +112,20 @@ public enum Lambda {
112112
_ = lifecycle.start().flatMap {
113113
lifecycle.shutdownFuture
114114
}
115-
.always { result in
115+
.always { lifecycleResult in
116116
signalSource.cancel()
117-
eventLoop.shutdownGracefully { _ in
117+
eventLoop.shutdownGracefully { error in
118+
if let error = error {
119+
preconditionFailure("Failed to shutdown eventloop: \(error)")
120+
}
118121
logger.info("shutdown")
119122
}
120123

121-
r = result
124+
result = lifecycleResult
122125
}
123126
}
124127

125128
logger.info("shutdown completed")
126-
127-
return r!
129+
return result
128130
}
129131
}

0 commit comments

Comments
 (0)