Skip to content

Commit

Permalink
refactor: make lambda function status readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 26, 2022
1 parent e65e1a2 commit 9e48817
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lambda/LambdaFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export default class LambdaFunction {

#runtime = null

#timeout = null
#status = 'IDLE' // can be 'BUSY' or 'IDLE'

status = 'IDLE' // can be 'BUSY' or 'IDLE'
#timeout = null

constructor(functionKey, functionDefinition, serverless, options) {
const {
Expand Down Expand Up @@ -265,8 +265,12 @@ export default class LambdaFunction {
return this.#functionName
}

get status() {
return this.#status
}

async runHandler() {
this.status = 'BUSY'
this.#status = 'BUSY'

if (!this.#initialized) {
await this.#initialize()
Expand Down Expand Up @@ -296,7 +300,7 @@ export default class LambdaFunction {
)
}

this.status = 'IDLE'
this.#status = 'IDLE'
this.#startIdleTimer()

return result
Expand Down

0 comments on commit 9e48817

Please sign in to comment.