Skip to content

Commit

Permalink
Merge pull request #1584 from testfirstcoder/improve-youngest-key-search
Browse files Browse the repository at this point in the history
improve youngest key search
  • Loading branch information
damianh authored Dec 3, 2024
2 parents 486dd4c + 3e94381 commit fa3d0ae
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ internal bool IsKeyRotationRequired(IEnumerable<KeyContainer> allKeys)
{
// there are younger keys, then they might also be within the window of the key activation delay
// so find the youngest one and treat that one as if it's the active key.
activeKey = keys.OrderByDescending(x => x.Created).First();
activeKey = keys.MaxBy(x => x.Created);
}

// if no younger keys, then check if we're nearing the expiration of active key
Expand Down Expand Up @@ -624,7 +624,7 @@ internal KeyContainer GetCurrentSigningKeyInternal(IEnumerable<KeyContainer> key
// discovery). we don't want the second server using a key that's not in the first server's
// discovery document. this will be somewhat mitigated by the initial duration where we
// deliberately ignore the cache.
var result = keys.OrderBy(x => x.Created).First();
var result = keys.MinBy(x => x.Created);
return result;
}

Expand Down

0 comments on commit fa3d0ae

Please sign in to comment.