Created
September 10, 2018 18:10
-
-
Save danillouz/70d57c1ae7e77091446050e668a90af7 to your computer and use it in GitHub Desktop.
Timeout routine as Lambda handler.
This file contains hidden or 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
'use strict'; | |
function timeout(ms) { | |
console.log('timeout start'); | |
return new Promise(resolve => { | |
setTimeout(() => { | |
console.log(`timeout cb fired after ${ms} ms`); | |
resolve(); | |
}, ms); | |
}); | |
} | |
async function main() { | |
console.log('main start'); | |
timeout(5e3); | |
console.log('main end'); | |
} | |
exports.handler = main; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment