Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create a lambda that recrawls changelogs discovered in the past
- const recrawlLambda = new lambda.Function(this, 'recrawl', {
- runtime: lambda.Runtime.NodeJS810,
- handler: 'recrawl.handle',
- code: lambda.Code.asset('./app/recrawl'),
- timeout: 360,
- environment: {
- CHANGELOGS_TABLE_NAME: props.changelogsTable.tableName,
- DISCOVERED_TOPIC_NAME: props.toCrawlTopic.topicArn
- }
- });
- // Grant the lambda permission to modify the tables
- props.changelogsTable.grantReadWriteData(recrawlLambda.role);
- props.toCrawlTopic.grantPublish(recrawlLambda.role);
- // Schedule the recrawler to run once every minute
- this.eventRule = new events.EventRule(this, 'recrawl-check-schedule', {
- scheduleExpression: 'rate(1 minute)',
- targets: [recrawlLambda]
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement