Skip to content

Remove Providers from Redis Queues When IsAvailable is Set to False #443

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

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

Conversation

sundayonah
Copy link
Collaborator

Description

This PR implements a feature to immediately remove providers from Redis queues when their IsAvailable status is set to false during a profile update, ensuring the system does not route orders to unavailable providers. The change addresses a user story requirement by modifying the UpdateProviderProfile function and introducing a new utility function, RemoveProviderFromQueues, in the utils package.

Purpose and Background

  • Ensures system integrity by preventing order routing to offline providers.
  • Moves queue removal logic to a reusable utility function for better modularity and maintainability.

Implementation Details

Check for IsAvailable Change: In UpdateProviderProfile, added logic to detect when IsAvailable transitions from true to false using isAvailableChangingToFalse

References

Closes #435

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this project has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation and tests for new/changed functionality in this PR
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not main

By submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.

@sundayonah sundayonah requested review from chibie and 5ran6 as code owners March 21, 2025 06:10
Copy link
Contributor

@chibie chibie left a comment

Choose a reason for hiding this comment

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

looks good to me

only remove uncessary log

utils/utils.go Outdated
continue
}

logger.Infof("Successfully removed provider %s from Redis queue %s", provider.ID, redisKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove log

onahprosper
onahprosper previously approved these changes Apr 19, 2025
@onahprosper
Copy link
Collaborator

I am approving this with the suggestion that For the sake that the removal of provider from queue can fail, I think we need to handle the return only allow such removal IFF certain conditions are met (e.g., the removal process from the queue succeeds).

@onahprosper
Copy link
Collaborator

@sundayonah conflict please

onahprosper and others added 20 commits April 28, 2025 20:12
…d priority queue services

- Updated error logging in  to ensure consistent formatting and improved contextual information for various failure scenarios.
- Enhanced error messages to include relevant details such as token addresses, order IDs, and provider IDs for better traceability.
- Refactored logging in  to align with the new formatting standards, ensuring clarity in error reporting.
- Improved error handling in  by adding more descriptive logging for RPC client connections and order operations.
…roviderController

- Updated the Stats method to separately aggregate USD and local stablecoin volumes.
- Enhanced error handling to log errors and return appropriate API responses when fetching provider stats fails.
- Adjusted total fiat volume calculation to account for different token currencies.
- Combined USD and local stablecoin volumes for the final response.
…clarity

- Enhanced the profile test to include additional token properties and commented out a test case for future restoration.
- Simplified error messages in the UpdateSenderProfile method for better readability.
- Replaced utility function calls with direct references to improve code clarity.
* Add JSON schema for smile ID types configuration

This commit introduces a new JSON schema file that defines the structure for smile ID types, including continents, countries, and their respective ID types. The schema enforces validation rules such as required fields, string patterns for country codes, and minimum item requirements for arrays.

* feat: add JSON schema for smile ID types configuration

This commit introduces a new JSON schema file that defines the structure for smile ID types, including continents, countries, and their respective ID types. The schema enforces validation rules such as required fields, string patterns for country codes, and minimum item requirements for arrays.

* test: add test to smileID implementation

* chore: rename 'document_image' to 'doc_verification' in smile_id_types.json

* chore: fix conflicts

* fix: close LoadSmileIDConfig function and clean up IsValidHttpsUrl

* feat: initialize aggregator with base structure

* feat: load SmileID configuration dynamically and refactor ID types generation

* fix: update country name reference to use country code in ID types generation

* refactor: improve SmileID configuration loading and flattening logic

* fix: reorganize Smile ID files according to new structure

* fix: implement robust file path resolution for Smile ID configuration

* fix: remove Kosovo (XK) and its ID types from countries verification configuration

* refactor(kyc): update identity verification request handling and signature verification

- Replaced the deprecated  with  across the codebase.
- Implemented a new method  for Ethereum signature validation.
- Enhanced error handling in the identity verification process by introducing specific error types for better clarity.
- Removed the  file as its functionality has been integrated into the new structure.

---------

Co-authored-by: Prosper <[email protected]>
Co-authored-by: Chibuotu Amadi <[email protected]>
chibie and others added 4 commits May 12, 2025 14:25
- Changed the environment configuration to use SERVER_URL instead of HOST_DOMAIN.
- Updated the KYC verification request structure to use types from the new shared types package.
- Removed the old KYC types and configuration files, streamlining the KYC service implementation.
- Adjusted tests to reflect the new structure and ensure compatibility with the updated KYC provider interface.
* feat: add metadata field to payment order and recipient models

- Introduced a new  field in the  and  entities to store additional information.
- Updated related functions and methods to handle the new  field, including setting, clearing, and querying its values.
- Refactored the server configuration to replace  with  for consistency.
- Adjusted various services and tests to accommodate the new metadata functionality.

* refactor: remove invalid signature format test from SmileID service

- Eliminated the test case for invalid signature format in the SmileID service tests to streamline the test suite.
- This change helps focus on relevant test scenarios and improves overall test clarity.

* feat: add metadata field to LinkedAddress entity and related functionality
* feat(ci): add Atlas database migrations workflow

- Add GitHub Actions workflow for automated database migrations
- Configure environment-specific database URLs for staging and production
- Run migrations on push to main and stable branches

* refactor(ci): remove pull request trigger from Atlas migration workflow
@sundayonah sundayonah requested review from onahprosper and chibie May 12, 2025 13:45
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.

Remove provider from queue when node is turned off
3 participants