Skip to content

Commit 4dac2bb

Browse files
committed
Add missing parentheses around logging scope computation
The modulo operator associated `0` and `100`, so the computation here was essentially `handle?.numericValue ?? (0 % 100)`, equivalent to `handle?.numericValue ?? 0`, which means that we didn’t acutally perform modulo operations on the numeric value, which means that we would exceed the maximum number of `os_log_t` objects after some time. rdar://162891887
1 parent 16c60b5 commit 4dac2bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SwiftSourceKitPlugin/Plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ final class RequestHandler: Sendable {
5858
func produceResult(
5959
body: @escaping @Sendable () async throws -> SKDResponseDictionaryBuilder
6060
) -> HandleRequestResult {
61-
withLoggingScope("request-\(handle?.numericValue ?? 0 % 100)") {
61+
withLoggingScope("request-\((handle?.numericValue ?? 0) % 100)") {
6262
let start = Date()
6363
logger.debug(
6464
"""

0 commit comments

Comments
 (0)