Skip to content

Commit

Permalink
Don't keep rebuilding high string
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 31, 2023
1 parent 476c067 commit b96fefe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Hummingbird/Server/RequestID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct RequestID: CustomStringConvertible {
}

var description: String {
String(Self.high, radix: 16) + self.formatAsHexWithLeadingZeros(self.low)
Self.high + self.formatAsHexWithLeadingZeros(self.low)
}

func formatAsHexWithLeadingZeros(_ value: UInt64) -> String {
Expand All @@ -35,6 +35,6 @@ struct RequestID: CustomStringConvertible {
}
}

private static let high = UInt64.random(in: .min ... .max)
private static let high = String(UInt64.random(in: .min ... .max), radix: 16)
private static let globalRequestID = ManagedAtomic<UInt64>(UInt64.random(in: .min ... .max))
}

0 comments on commit b96fefe

Please sign in to comment.