Skip to content

Conversation

@bseverino
Copy link
Member

@bseverino bseverino commented Jan 12, 2026

https://redventures.atlassian.net/browse/EDUN-8253

Cache get_program_variants response by product_key, refreshing after 4 hours

Merge checklist:
Check off if complete or not applicable:

  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

Post-merge:

Copilot AI review requested due to automatic review settings January 12, 2026 21:03
@bseverino bseverino requested a review from a team as a code owner January 12, 2026 21:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds caching to the get_program_variants method to improve performance by reducing redundant API calls to Commercetools. The cache stores program variant data for approximately 24 hours.

Changes:

  • Added a new cache TTL constant (GET_PROGRAM_CACHE_TTL_SECS) set to 23 hours and 59 minutes
  • Implemented caching logic in get_program_variants using TieredCache to store and retrieve program variant data
  • Updated the test for get_program_variants to verify caching behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
commerce_coordinator/apps/commercetools/constants.py Added cache TTL constant for program variants caching
commerce_coordinator/apps/commercetools/http_api_client.py Implemented caching logic in get_program_variants method with cache key generation and storage
commerce_coordinator/apps/commercetools/tests/test_http_api_client.py Updated test to include cache verification and added tearDown to clear cache between tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bseverino bseverino force-pushed the bseverino/EDUN-8059-program-price-cache branch from 0818f48 to 4dd44de Compare January 12, 2026 21:26
Copilot AI review requested due to automatic review settings January 12, 2026 21:38
@bseverino bseverino force-pushed the bseverino/EDUN-8059-program-price-cache branch from 4dd44de to 70aa94b Compare January 12, 2026 21:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bseverino bseverino force-pushed the bseverino/EDUN-8059-program-price-cache branch from 70aa94b to bd6bae3 Compare January 12, 2026 21:46
@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  commerce_coordinator/apps/commercetools
  constants.py
  http_api_client.py 154
  commerce_coordinator/apps/commercetools/tests
  test_http_api_client.py
Project Total  

This report was generated by python-coverage-comment-action

Copilot AI review requested due to automatic review settings January 14, 2026 15:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bseverino bseverino merged commit 25bb739 into main Jan 14, 2026
14 checks passed
@bseverino bseverino deleted the bseverino/EDUN-8059-program-price-cache branch January 14, 2026 15: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.

3 participants