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

refactor(currency_conversion): release redis lock if api call fails #6671

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

prajjwalkumar17
Copy link
Contributor

@prajjwalkumar17 prajjwalkumar17 commented Nov 27, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Refactors for currency conversion which invlolves:
-> Better error propagation
-> Redis lock realease, if data isn't fetched from api, so that the other subsequent calls donot fail.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Reqired for analytics

How did you test it?

Scenarios tested:

  1. No api_keys provided: call returned error and redis key was deleted after being set.
  2. fallback api_key provided: call returned forex rates and lock was also released.
  3. primary api_key provided: call returned forex rates and lock was also released.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@prajjwalkumar17 prajjwalkumar17 added the A-currency-conversion Area: Currency Conversion label Nov 27, 2024
@prajjwalkumar17 prajjwalkumar17 added this to the November 2024 Release milestone Nov 27, 2024
@prajjwalkumar17 prajjwalkumar17 self-assigned this Nov 27, 2024
@prajjwalkumar17 prajjwalkumar17 requested a review from a team as a code owner November 27, 2024 07:12
Copy link

semanticdiff-com bot commented Nov 27, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/utils/currency.rs  54% smaller

@prajjwalkumar17 prajjwalkumar17 marked this pull request as ready for review November 27, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-currency-conversion Area: Currency Conversion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant