constructor(parent, id, props) { super(parent, id, props); // Create a lambda that recrawls changelogs discovered in the past const recrawlLambda = new lambda.Function(this, 'recrawl', { runtime: lambda.Runtime.NODEJS_12_X, handler: 'recrawl.handle', code: lambda.Code.asset('./app/recrawl'), timeout: cdk.Duration.minutes(5), 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.Rule(this, 'recrawl-check-schedule', { schedule: events.Schedule.rate(cdk.Duration.minutes(1)), targets: [new eventTargets.LambdaFunction(recrawlLambda)] }); }
schedule: events.Schedule.rate(cdk.Duration.minutes(1)), targets: [new eventTargets.LambdaFunction(regenerateHomepage)] });
constructor(parent, id, props) { super(parent, id, props); // Create a lambda that returns autocomplete results const recentlyCrawled = new lambda.Function(this, 'recently-crawled', { runtime: lambda.Runtime.NODEJS_12_X, handler: 'recently-crawled.handle', code: lambda.Code.asset('./app/recently-crawled'), environment: { FEEDS_TABLE_NAME: props.feedsTable.tableName, API_BUCKET_NAME: props.apiBucket.bucketName } }); // Grant the lambda permission to modify the tables and S3 bucket props.feedsTable.grantReadWriteData(recentlyCrawled.role); props.apiBucket.grantReadWrite(recentlyCrawled.role); // Schedule the recrawler to run once every minute this.eventRule = new events.Rule(this, 'recrawl-check-schedule', { schedule: events.Schedule.rate(cdk.Duration.minutes(1)), targets: [new eventTargets.LambdaFunction(recentlyCrawled)] }); }
constructor(parent, id, props) { super(parent, id, props); // Create the lambda const pypiFollower = new lambda.Function(this, 'pypi-follower', { runtime: lambda.Runtime.NODEJS_12_X, handler: 'pypi-recent.handle', code: lambda.Code.asset('./app/pypi-recent'), timeout: cdk.Duration.minutes(1), environment: { CHANGELOGS_TABLE_NAME: props.changelogsTable.tableName, DISCOVERED_TOPIC_NAME: props.toCrawlTopic.topicArn } }); // Grant this application access to the DynamoDB table and SNS topic props.changelogsTable.grantReadWriteData(pypiFollower.role); props.toCrawlTopic.grantPublish(pypiFollower.role); // Schedule the follower to run once every 5 mins this.eventRule = new events.Rule(this, 'check-recent-pypi', { schedule: events.Schedule.rate(cdk.Duration.minutes(5)), targets: [new eventTargets.LambdaFunction(pypiFollower)] }); }
constructor(parent, id, props) { super(parent, id, props); // Create the lambda const rubygemFollower = new lambda.Function(this, 'rubygem-follower', { runtime: lambda.Runtime.NODEJS_12_X, handler: 'rubygem-recent.handle', code: lambda.Code.asset('./app/rubygem-recent'), timeout: cdk.Duration.minutes(1), environment: { CHANGELOGS_TABLE_NAME: props.changelogsTable.tableName, DISCOVERED_TOPIC_NAME: props.toCrawlTopic.topicArn } }); // Grant this application access to the DynamoDB table and SNS topic props.changelogsTable.grantReadWriteData(rubygemFollower.role); props.toCrawlTopic.grantPublish(rubygemFollower.role); // Schedule the follower to run once every 5 mins this.eventRule = new events.Rule(this, 'check-recent-rubygems', { schedule: events.Schedule.rate(cdk.Duration.minutes(5)), targets: [new eventTargets.LambdaFunction(rubygemFollower)] }); }