Created
September 16, 2018 14:31
-
-
Save itaysabato/511ec7fe89847749e00fdebba51d22d0 to your computer and use it in GitHub Desktop.
Simple AWS Lambda function that waits as long as it is told
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
exports.handler = ({queryStringParameters: {wait}}, context, callback) => { | |
const response = { | |
statusCode: 200, | |
isBase64Encoded: false, | |
headers: {"Access-Control-Allow-Origin": "*"}, | |
body: JSON.stringify({res: `This has taken ${wait} milliseconds.`}), | |
}; | |
const startTime = Date.now(); | |
while (Date.now() - startTime < wait) {/** CALCULATING... **/} | |
callback(null, response); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment