Skip to content

Waiting for provisioned concurrency on Lambdas #1350

Closed Answered by ianbotsf
NikolayMetchev asked this question in Q&A
Discussion options

You must be logged in to vote

Something like this I think:

suspend fun waitUntilConcurrencyUpdated(func: String, alias: String) {
    while (true) {
        val status = lambda.getProvisionedConcurrencyConfig {
            functionName = func
            qualifier = alias
        }

        when (status.status) {
            ProvisionedConcurrencyStatusEnum.Ready -> return
            ProvisionedConcurrencyStatusEnum.Failed -> error("Could not update provisioned concurrency")
            else -> { /* continue loop */ }
        }

        delay(3.seconds) // wait a sensible amount of time to avoid throttling
    }
}

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@NikolayMetchev
Comment options

@NikolayMetchev
Comment options

@ianbotsf
Comment options

@ianbotsf
Comment options

Answer selected by RanVaknin
@NikolayMetchev
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants