Skip to content

Commit 8f07caf

Browse files
author
Andrea Scuderi
committed
Fix: Random Crash tonisuter#9
1 parent 3f7d56a commit 8f07caf

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Examples/SquareNumber/Sources/SquareNumber/main.swift

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ func squareNumber(input: Input, context: Context) -> Output {
1212
let squaredNumber = input.number * input.number
1313
return Output(result: squaredNumber)
1414
}
15-
16-
let runtime = try Runtime()
17-
runtime.registerLambda("squareNumber", handlerFunction: squareNumber)
18-
try runtime.start()
15+
do {
16+
let runtime = try Runtime()
17+
runtime.registerLambda("squareNumber", handlerFunction: squareNumber)
18+
try runtime.start()
19+
} catch (let error) {
20+
log(error)
21+
}

Sources/AWSLambdaSwift/Runtime.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ public class Runtime {
2121
var handlers: [String: Handler]
2222

2323
public init() throws {
24-
self.urlSession = URLSession(configuration: .default)
24+
25+
let configuration = URLSessionConfiguration.default
26+
configuration.timeoutIntervalForRequest = 3600
27+
28+
29+
self.urlSession = URLSession(configuration: configuration)
2530
self.handlers = [:]
2631

2732
let environment = ProcessInfo.processInfo.environment

0 commit comments

Comments
 (0)