Created
December 21, 2018 05:47
-
-
Save jasonbyrne/9ae29298b7d5012b48f0bbcf5e793c2a to your computer and use it in GitHub Desktop.
Proof of Concept: Persistent Data with Lambda
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
let counter = 0; | |
exports.handler = async (event) => { | |
counter++; | |
return { | |
statusCode: 200, | |
body: JSON.stringify(counter), | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very clever code Kaleb wrote to call this 100 times at a growing interval
(()=>{
const url = 'YOUR LAMBDA URL HERE';
const invocations = Array(100).fill('')
const callIt = () => {
return fetch(url,
{
method: 'GET'
}
).then(function(resp) {
return resp.text();
})
.then(function(data) {
console.log('data', data);
})
.catch((err) => {
console.error('Error', err);
});
}
invocations.forEach((_, i) => {
setTimeout(() => {
callIt()
}, i * 50)
})
})()