Skip to content

Instantly share code, notes, and snippets.

@jasonbyrne
Created December 21, 2018 05:47
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 jasonbyrne/9ae29298b7d5012b48f0bbcf5e793c2a to your computer and use it in GitHub Desktop.
Save jasonbyrne/9ae29298b7d5012b48f0bbcf5e793c2a to your computer and use it in GitHub Desktop.
Proof of Concept: Persistent Data with Lambda
let counter = 0;
exports.handler = async (event) => {
counter++;
return {
statusCode: 200,
body: JSON.stringify(counter),
};
};
@jasonbyrne
Copy link
Author

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)
})
})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment