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

changed behaviour to raise error instead of using default db when re… #157

Merged
merged 4 commits into from
Nov 20, 2024

Conversation

darefalola
Copy link
Contributor

Thoas has the following behaviour such that when a release version is requested via the genome uuid, one of the following happens:

  • If a release is found, it is returned to Thoas.
  • If gRPC connection is down, a default release version is used.
  • If the release is not found, a default release version is used.

The diagram below shows a clearer view of this issue

sequenceDiagram
    title GraphQL Core Generic Workflow
    actor User as User
    participant GraphQL_BE as GraphQL UI/Backend
    participant gRPC as gRPC Service
    participant Metadata_DB as Metadata Database
    participant Mongo_DB as Mongo Database
    
    User ->> GraphQL_BE: Sends Query Request
    GraphQL_BE ->> gRPC: Request Release Version using Genome UUID
    gRPC ->> Metadata_DB: Fetch Release Version
    Note over gRPC, Metadata_DB: Example version: 110.3

    alt gRPC Connection Success
        opt Release Found in Metadata DB
            Metadata_DB -->> gRPC: Release Found
            gRPC -->> GraphQL_BE: Return Release Version
            GraphQL_BE ->> Mongo_DB: Fetch data from Mongo
            Note over GraphQL_BE, Mongo_DB: e.g., 'release_110_3' Mongo DB
            Mongo_DB -->> User: Return Fetched Data
        end

        opt Release NOT Found in Metadata DB
            Metadata_DB -->> gRPC: Release NOT Found
            gRPC -->> GraphQL_BE: Notify Release Not Found
            GraphQL_BE -->> GraphQL_BE: Fallback to "default_mongo_db"
            Note over GraphQL_BE: Default Mongo DB used as fallback
            GraphQL_BE ->> Mongo_DB: Fetch data from default Mongo (e.g., 'release_110_1')
            Mongo_DB -->> User: Return Fallback Data
        end
    else gRPC Connection FAILED
        gRPC -->> GraphQL_BE: Connection Failed
        GraphQL_BE -->> GraphQL_BE: Fallback to "default_mongo_db"
        Note over GraphQL_BE: Using default Mongo DB due to gRPC failure
        GraphQL_BE ->> Mongo_DB: Fetch data from default Mongo (e.g., 'release_110_1')
        Mongo_DB -->> User: Return Fallback Data
    end
Loading

This PR adds a fix such that if a release is not found or gRPC connection is unreachable, it returns an error to the user rather than using a default db.

Copy link
Contributor

@bilalebi bilalebi left a comment

Choose a reason for hiding this comment

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

It's working as expected 👍

@darefalola darefalola merged commit 9b0faf6 into develop Nov 20, 2024
1 check passed
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.

2 participants