Skip to content

Instantly share code, notes, and snippets.

@M0dM
Created February 28, 2019 10:36
Show Gist options
  • Save M0dM/c90360495e9924e7be727054b2a61e4e to your computer and use it in GitHub Desktop.
Save M0dM/c90360495e9924e7be727054b2a61e4e to your computer and use it in GitHub Desktop.
Integrate lambdawarmer with zappa
--- unzipped2/zappa/handler.py 1980-01-01 00:00:00.000000000 +0100
+++ unzipped/zappa/handler.py 2019-02-28 11:04:44.445385373 +0100
@@ -576,9 +576,15 @@
return content
-def lambda_handler(event, context): # pragma: no cover
- return LambdaHandler.lambda_handler(event, context)
+try:
+ import lambdawarmer
+ @lambdawarmer()
+ def lambda_handler(event, context): # pragma: no cover
+ return LambdaHandler.lambda_handler(event, context)
+except: # pragma: no cover
+ def lambda_handler(event, context): # pragma: no cover
+ return LambdaHandler.lambda_handler(event, context)
def keep_warm_callback(event, context):
"""Method is triggered by the CloudWatch event scheduled when keep_warm setting is set to true."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment