Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. // Create a lambda that recrawls changelogs discovered in the past
  2. const recrawlLambda = new lambda.Function(this, 'recrawl', {
  3. runtime: lambda.Runtime.NodeJS810,
  4. handler: 'recrawl.handle',
  5. code: lambda.Code.asset('./app/recrawl'),
  6. timeout: 360,
  7. environment: {
  8. CHANGELOGS_TABLE_NAME: props.changelogsTable.tableName,
  9. DISCOVERED_TOPIC_NAME: props.toCrawlTopic.topicArn
  10. }
  11. });
  12.  
  13. // Grant the lambda permission to modify the tables
  14. props.changelogsTable.grantReadWriteData(recrawlLambda.role);
  15. props.toCrawlTopic.grantPublish(recrawlLambda.role);
  16.  
  17. // Schedule the recrawler to run once every minute
  18. this.eventRule = new events.EventRule(this, 'recrawl-check-schedule', {
  19. scheduleExpression: 'rate(1 minute)',
  20. targets: [recrawlLambda]
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement