diff --git a/src/lambda/LambdaFunction.js b/src/lambda/LambdaFunction.js index 242cd645a..02eca9e40 100644 --- a/src/lambda/LambdaFunction.js +++ b/src/lambda/LambdaFunction.js @@ -306,31 +306,31 @@ export default class LambdaFunction { this.#handlerRunner.run(this.#event, context), ...(this.#noTimeout ? [] : [this.#timeoutAndTerminate()]), ]) + + this.#stopExecutionTimer() + + // TEMP TODO FIXME find better solution + if (!this.#handlerRunner.isDockerRunner()) { + log.notice( + `(λ: ${ + this.#functionKey + }) RequestId: ${requestId} Duration: ${this.#executionTimeInMillis().toFixed( + 2, + )} ms Billed Duration: ${this.#billedExecutionTimeInMillis()} ms`, + ) + } } catch (err) { if (err instanceof LambdaTimeoutError) { await this.#handlerRunner.cleanup() } throw err - } - - this.#stopExecutionTimer() + } finally { + this.#status = 'IDLE' - // TEMP TODO FIXME find better solution - if (!this.#handlerRunner.isDockerRunner()) { - log.notice( - `(λ: ${ - this.#functionKey - }) RequestId: ${requestId} Duration: ${this.#executionTimeInMillis().toFixed( - 2, - )} ms Billed Duration: ${this.#billedExecutionTimeInMillis()} ms`, - ) + this.#startIdleTimer() } - this.#status = 'IDLE' - - this.#startIdleTimer() - return result } }