Skip to content

Instantly share code, notes, and snippets.

@danillouz
Created September 10, 2018 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danillouz/70d57c1ae7e77091446050e668a90af7 to your computer and use it in GitHub Desktop.
Save danillouz/70d57c1ae7e77091446050e668a90af7 to your computer and use it in GitHub Desktop.
Timeout routine as Lambda handler.
'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