Skip to content

Commit

Permalink
Increase cody.ignore.policy.timeout (#2135)
Browse files Browse the repository at this point in the history
## Test plan
1. Green CI
  • Loading branch information
mkondratek authored Aug 28, 2024
1 parent 75364c9 commit c9968af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fun Test.sharedIntegrationTestConfig(buildCodyDir: File, mode: String) {
"cody.autocomplete.enableFormatting" to
(project.property("cody.autocomplete.enableFormatting") as String? ?: "true"),
"cody.integration.testing" to "true",
"cody.ignore.policy.timeout" to 500, // Increased to 500ms as CI tends to be slower
"cody.ignore.policy.timeout" to 1500, // Increased to 1500ms as CI tends to be slower
"idea.test.execution.policy" to "com.sourcegraph.cody.test.NonEdtIdeaTestExecutionPolicy",
"test.resources.dir" to resourcesDir.absolutePath)

Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/com/sourcegraph/cody/ignore/IgnoreOracle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.runInEdt
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.fileEditor.FileEditorManager
Expand All @@ -29,6 +30,8 @@ enum class IgnorePolicy(val value: String) {
*/
@Service(Service.Level.PROJECT)
class IgnoreOracle(private val project: Project) {
private val logger = Logger.getInstance(IgnoreOracle::class.java)

data class CacheEntry(val policy: IgnorePolicy, val timestampMsec: Long)

private val cache = SLRUMap<String, CacheEntry>(100, 100)
Expand Down Expand Up @@ -136,6 +139,7 @@ class IgnoreOracle(private val project: Project) {
return try {
completable.get(policyAwaitTimeoutMs, TimeUnit.MILLISECONDS)
} catch (timedOut: TimeoutException) {
logger.warn(timedOut)
null
}
}
Expand Down

0 comments on commit c9968af

Please sign in to comment.