awslabs / amazon-dynamodb-lock-client

The AmazonDynamoDBLockClient is a general purpose distributed locking library built on top of DynamoDB. It supports both coarse-grained and fine-grained locking.
Other
472 stars 85 forks source link

Heartbeat thread working with lambda #63

Open nitika-bansal opened 2 years ago

nitika-bansal commented 2 years ago

Hi,

I was looking for implementing the DDB lock client inside a lambda. As per the lambda documentation here,

After the function and all extensions have completed, Lambda maintains the execution environment for some time in anticipation of another function invocation. In effect, Lambda freezes the execution environment. When the function is invoked again, Lambda thaws the environment for reuse.

So here, I wanted to understand, how does the heartbeat BG thread works in case of any lambda failure/timeout. Is it safe to assume that background thread will die as well, or it might be the case as it says in the documentation here, that if another lambda is executed in the same context, heartbeat thread might continue it's execution from there.