Skip to content

Commit 8085719

Browse files
authored
fix supplemental context log latency always says 0ms (#5040)
1 parent 46f88ae commit 8085719

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/util/CodeWhispererFileContextProvider.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ class DefaultCodeWhispererFileContextProvider(private val project: Project) : Fi
144144
}
145145

146146
return supplementalContext?.let {
147+
val latency = System.currentTimeMillis() - startFetchingTimestamp
147148
if (it.contents.isNotEmpty()) {
148149
val logStr = buildString {
149-
append("Successfully fetched supplemental context with strategy ${it.strategy} with ${it.latency} ms")
150+
append("Successfully fetched supplemental context with strategy ${it.strategy} with $latency ms")
150151
it.contents.forEachIndexed { index, chunk ->
151152
append(
152153
"""
@@ -166,8 +167,7 @@ class DefaultCodeWhispererFileContextProvider(private val project: Project) : Fi
166167
LOG.warn { "Failed to fetch supplemental context, empty list." }
167168
}
168169

169-
// TODO: fix this latency
170-
it.copy(latency = System.currentTimeMillis() - startFetchingTimestamp)
170+
it.copy(latency = latency)
171171
}
172172
} catch (e: TimeoutCancellationException) {
173173
LOG.debug {

0 commit comments

Comments
 (0)