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

TFRS: Setup Redis Service and Call LCFS Cache for Available Balances #1074

Open
4 tasks
AlexZorkin opened this issue Oct 18, 2024 · 0 comments
Open
4 tasks
Labels
Medium Medium priority Task Work that does not directly impact the user

Comments

@AlexZorkin
Copy link
Collaborator

Description:
This task involves setting up a Redis service in TFRS that will allow cross-namespace access to the Redis cache in LCFS. The purpose is to replace the existing get_max_credit_offset methods in api/services/OrganizationService.py with a call to the Redis cache in LCFS. This call will fetch the available balance for an organization based on the organization_id and compliance_period. This new method will ensure that the TFRS system calculates the available balance for compliance reporting by pulling real-time data from the Redis cache in LCFS.

Purpose:
The purpose of this task is to streamline the process of calculating available balances for compliance reporting in TFRS by using Redis caching from LCFS. This approach will ensure that TFRS reflects the most up-to-date and accurate compliance unit balances when generating compliance reports or calculating potential penalties.

Development Requirements:

  • Set up a Redis service in TFRS with the ability to access the Redis instance in the LCFS namespace via a cross-namespace connection.
  • In api/services/OrganizationService.py, update the get_max_credit_offset methods to replace the current balance calculation logic with a Redis call to fetch the available balance for the organization_id and compliance_period from the LCFS cache.
  • Ensure that the Redis call retrieves the correct balance for the specified organization and compliance period.
  • Test the new Redis call thoroughly to ensure that the TFRS system accurately reflects available balances during compliance reporting.

Additional Context:

  • The Redis cache in LCFS stores the balances using the organization_id_compliance_period as the key. Ensure that the Redis call uses this format to fetch the appropriate value.
  • The available balance in Redis should include all current commitments and transactions, so TFRS reflects the true balance for compliance.
  • Any edge cases around missing or stale data in Redis should be handled appropriately to ensure no incorrect balances are returned.
@AlexZorkin AlexZorkin added Medium Medium priority Task Work that does not directly impact the user labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Medium priority Task Work that does not directly impact the user
Projects
None yet
Development

No branches or pull requests

1 participant