Skip to content

Commit

Permalink
Merge pull request #956 from clement911/master
Browse files Browse the repository at this point in the history
Handle GraphQL API bucket state bug.
  • Loading branch information
clement911 authored Nov 13, 2023
2 parents 25e4cbe + 4bd6d7e commit 765b520
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public void SetRESTBucketState(int maximumAvailable, double currentlyAvailable)

public void SetGraphQLBucketState(int maximumAvailable, int restoreRatePerSecond, double currentlyAvailable, int refund)
{
//There seems to be a bug in the GraphQL API. It sometimes returns a currentlyAvailable larger than maximumAvailable.
if (currentlyAvailable > maximumAvailable)
currentlyAvailable = maximumAvailable;

currentlyAvailable = Math.Max(0, Math.Min(currentlyAvailable, GraphQLBucket.ComputedCurrentlyAvailable + refund));
GraphQLBucket.SetState(maximumAvailable, restoreRatePerSecond, currentlyAvailable);
}
Expand Down

0 comments on commit 765b520

Please sign in to comment.