Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Lambda: add scheduled cleanup lambda #123

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Conversation

sb-dev
Copy link
Contributor

@sb-dev sb-dev commented Jan 29, 2025

What does this change?

Add a scheduled cleanup lambda to delete stories older than 2 weeks.

Scheduled to run every day at 5am.

How to test

How can we measure success?

Have we considered potential risks?

Images

Accessibility

@sb-dev sb-dev requested a review from a team as a code owner January 29, 2025 17:52
cleanup-lambda/src/rds.ts Outdated Show resolved Hide resolved
@sb-dev sb-dev force-pushed the add-cleanup-lambda branch 2 times, most recently from b43d481 to 98d7354 Compare January 30, 2025 10:03
@sb-dev sb-dev force-pushed the add-cleanup-lambda branch from 98d7354 to e434cdf Compare January 30, 2025 10:13
architecture: LAMBDA_ARCHITECTURE,
handler: 'handler.main',
fileName: 'cleanup-lambda.zip',
timeout: Duration.millis(45000),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason for this timeout? My instinct is to go for a longer timeout as it's a batch job.. Have we done any tests to see how long it would usually take to complete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done any test yet; the 45s timeout is just a place holder while waiting to figure a better value for it.


console.log(`Deleted ${result.count} records`);
} catch (error) {
console.error('Error deleting old records:', error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might we want to fail the job in this case, so that we can add retry behaviour? (this could wait for a separate PR though)

@sb-dev sb-dev force-pushed the add-cleanup-lambda branch from eb65cc8 to 2d57399 Compare January 30, 2025 12:25
Copy link
Contributor

@bryophyta bryophyta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@sb-dev sb-dev force-pushed the add-cleanup-lambda branch from 2d57399 to 36743d1 Compare January 30, 2025 16:19
@sb-dev sb-dev merged commit 62a00f2 into main Jan 30, 2025
3 checks passed
@sb-dev sb-dev deleted the add-cleanup-lambda branch January 30, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants