Skip to content

Commit

Permalink
Removed cache operation in Schema()
Browse files Browse the repository at this point in the history
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
  • Loading branch information
meetrick committed Apr 29, 2024
1 parent 90e1bc8 commit e15cae8
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions x/accounts/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,12 @@ func (q *queryServer) AccountQuery(ctx context.Context, request *v1.AccountQuery
// Schema retrieves the schema for a given account type.
// It checks the cache first and computes the schema if not found.
func (q *queryServer) Schema(_ context.Context, request *v1.SchemaRequest) (*v1.SchemaResponse, error) {
// Check if the schema is cached.
if schema, ok := q.schemaCache[request.AccountType]; ok {
return schema, nil
}

// Fetch schema from precalculated schemas.
schema, ok := q.schemas[request.AccountType]
if !ok {
return nil, fmt.Errorf("%w: %s", errAccountTypeNotFound, request.AccountType)
}

// Cache the schema for future use.
q.schemaCache[request.AccountType] = schema

return schema, nil
}

Expand Down

0 comments on commit e15cae8

Please sign in to comment.