Skip to content

Commit

Permalink
do not use async data source when metadata is too large
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Norton committed Feb 22, 2024
1 parent 49d8817 commit 734cd96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions policy/data/gql_async.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ func (ds AsyncDataSource) Query(ctx context.Context, queryName string, query str
return nil, fmt.Errorf("failed to marshal metadata: %w", err)
}

metadata64 := b64.StdEncoding.EncodeToString(metadataEdn)
if len(metadata64) > 1024 {
ds.log.Warnf("Skipping async data source usage for query %s due to metadata overflow!", queryName)
return nil, nil
}

request := AsyncQueryRequest{
Name: AsyncQueryName,
Body: AsyncQueryBody{
Expand Down

0 comments on commit 734cd96

Please sign in to comment.