Created
February 28, 2019 10:36
-
-
Save M0dM/c90360495e9924e7be727054b2a61e4e to your computer and use it in GitHub Desktop.
Integrate lambdawarmer with zappa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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