Skip to content

feat: add content CDN cache invalidation on course update and deletion#953

Open
AbuJulaybeeb wants to merge 3 commits into
rinafcode:mainfrom
AbuJulaybeeb:feature/issue-844-cdn-cache-invalidation
Open

feat: add content CDN cache invalidation on course update and deletion#953
AbuJulaybeeb wants to merge 3 commits into
rinafcode:mainfrom
AbuJulaybeeb:feature/issue-844-cdn-cache-invalidation

Conversation

@AbuJulaybeeb

Copy link
Copy Markdown

What was done

  • Added invalidate(paths: string[]) to CdnService using the @aws-sdk/client-cloudfront CreateInvalidationCommand.
  • Integrated opossum Circuit Breaker into CdnService to ensure CDN provider failures do not crash or hang course updates.
  • Created CdnEventListener to subscribe to course.updated and course.deleted events and automatically trigger CDN invalidation for the affected paths.
  • Wrote unit tests in src/cdn/cdn.service.spec.ts testing the invalidation logic, error handling, and circuit breaker functionality with a mocked CDN provider.
  • Registered the new listener within CdnModule.

Why it was done

To resolve issue #844. Previously, students could see stale course materials for hours after a course was updated or deleted because the edge caches weren't invalidated. This implementation ensures real-time cache invalidation on content changes, keeping content served to end-users synchronized.

How it was verified

  • Automated unit tests were added verifying that CreateInvalidationCommand receives the correct distribution ID and paths.
  • Circuit breaker tests verify that timeouts or failures gracefully fall back and return failure responses instead of propagating errors.

Closes #844

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@AbuJulaybeeb Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Great job so far

There’s just one blocker — the workflow is failing. Could you take a look and fix it so all checks pass?

Happy to review again once that’s done.

@AbuJulaybeeb

Copy link
Copy Markdown
Author

Great job so far

There’s just one blocker — the workflow is failing. Could you take a look and fix it so all checks pass?

Happy to review again once that’s done.

ohk on it

@AbuJulaybeeb AbuJulaybeeb force-pushed the feature/issue-844-cdn-cache-invalidation branch from 2acdae0 to 120265d Compare June 29, 2026 23:49
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.

Add content CDN cache invalidation on course update and deletion

2 participants