Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var AWS = require('aws-sdk');
var swf = new AWS.SWF();
exports.handler = function(event, context) {
console.log('Loop started !', JSON.stringify(event, null, 2) );
function callMySelfAndQuit() {
var lambda = new AWS.Lambda();
lambda.invoke({
FunctionName: context.functionName,
InvocationType: 'Event',
LogType: 'None',
Payload: JSON.stringify({
counter: event.counter + 1,
parent: context.awsRequestId
})
}, function(err, d) {
if (err) {
console.log(err, err.stack);
}
else {
console.log('Calling my-self success !', JSON.stringify(d, null, 2) );
}
context.succeed({});
});
}
setTimeout(callMySelfAndQuit, 50000);
};
@DavidWells

This comment has been minimized.

Copy link

@DavidWells DavidWells commented Jan 19, 2016

This looks interesting =)

Is this a lambda function that will respawn itself? Or call another lambda function?

Thanks

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