-
-
Save maxbeatty/573a2622d88d044c8ce2a346b5e46573 to your computer and use it in GitHub Desktop.
AWS Lambda module caching anti-pattern
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
var first = true; | |
module.exports = function () { | |
console.log(`first: ${first}`); | |
if (first) { | |
first = false; | |
} | |
}; |
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
const b = require('./b'); | |
exports.handle = function handle(event, context, callback) { | |
var i = 0; | |
while (i++ < 4) { | |
b(); | |
} | |
callback(); | |
}; |
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
/aws/lambda/module-cache-test START RUN 1 | |
/aws/lambda/module-cache-test 2017-03-05T18:36:51.853Z first: true | |
/aws/lambda/module-cache-test 2017-03-05T18:36:51.854Z first: false | |
/aws/lambda/module-cache-test 2017-03-05T18:36:51.854Z first: false | |
/aws/lambda/module-cache-test 2017-03-05T18:36:51.854Z first: false | |
/aws/lambda/module-cache-test END | |
/aws/lambda/module-cache-test START RUN 2 | |
/aws/lambda/module-cache-test 2017-03-05T18:37:39.899Z first: false | |
/aws/lambda/module-cache-test 2017-03-05T18:37:39.899Z first: false | |
/aws/lambda/module-cache-test 2017-03-05T18:37:39.899Z first: false | |
/aws/lambda/module-cache-test 2017-03-05T18:37:39.899Z first: false | |
/aws/lambda/module-cache-test END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment