grants-stack icon indicating copy to clipboard operation
grants-stack copied to clipboard

create Cluster Matching server architecture doc and milestone

Open gravityblast opened this issue 11 months ago • 0 comments

sequenceDiagram
    participant Manager
    participant MatchingCalculator
    participant ResultsTable
    participant Worker
    participant IndexerDB
    participant Storage

    Manager->>MatchingCalculator: Request matching results (roundChainId, roundId)
    MatchingCalculator->>ResultsTable: Check for result in last hour
    alt If result exists and is up-to-date
        ResultsTable-->>MatchingCalculator: Return existing URL
        MatchingCalculator-->>Manager: URL of results
    else If no up-to-date result
        ResultsTable->>MatchingCalculator: Check if pending or done
        alt If no result or done
            MatchingCalculator->>ResultsTable: Create/update result as pending
            Note right of Worker: Worker periodically checks for pending results
            Worker->>ResultsTable: Check for pending results
            alt If pending result found
                ResultsTable->>Worker: Job details
                Worker->>IndexerDB: Fetch list of votes for round
                IndexerDB-->>Worker: Return votes
                Worker->>Worker: Calculate matchings
                Worker->>Storage: Save matching file
                Storage-->>Worker: Confirm file saved
                Worker->>ResultsTable: Update result with URL and set as done
            end
        else If pending
            MatchingCalculator-->>Manager: Job already in progress
        end
    end

gravityblast avatar Feb 26 '24 13:02 gravityblast