Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase the ServerActiveCheck timeout because 10ms is toooo faaaaaast #100

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

aSemy
Copy link
Contributor

@aSemy aSemy commented Jun 26, 2023

1 second seems to be more than enough. There doesn't seem to be a downside to having a long timeout - the check fails almost instantly if IntelliJ isn't running (which isn't what I originally thought).

I used this task to experiment:

//build.gradle.kts


import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.time.Duration
import kotlin.time.ExperimentalTime
import kotlin.time.TimeSource
import kotlin.time.measureTimedValue

@OptIn(ExperimentalTime::class)
val urlTimeoutCheck by tasks.registering {
  doLast {

    repeat(100) {
      Thread.sleep(500)
      val timeMark = TimeSource.Monotonic.markNow()
      runCatching {
        val uri = URI.create("http://localhost:63342")
        val client = HttpClient.newHttpClient()
        val request = HttpRequest
          .newBuilder()
          .uri(uri)
//          .timeout(Duration.ofMillis(100))
          .GET()
          .build()
        val response = client.send(request, HttpResponse.BodyHandlers.ofString())
        println("HTTP${response.statusCode()} in ${timeMark.elapsedNow()}")
      }.onFailure { println("failed in ${timeMark.elapsedNow()}") }
    }
  }
}

@aSemy aSemy enabled auto-merge (squash) June 26, 2023 21:52
@aSemy aSemy added this to the v1.5.1 milestone Jun 26, 2023
@aSemy aSemy disabled auto-merge June 26, 2023 22:14
@aSemy aSemy changed the title increase the ServerActiveCheck timeout because 10ms is toooo sloooooow increase the ServerActiveCheck timeout because 10ms is toooo faaaaaast Jun 26, 2023
@aSemy aSemy force-pushed the fix/report_url_logger_timeout branch from 331d3fc to 5ad0ae7 Compare June 26, 2023 22:15
@aSemy aSemy enabled auto-merge (squash) June 26, 2023 22:15
@aSemy aSemy merged commit 5eb92dd into main Jun 26, 2023
@aSemy aSemy deleted the fix/report_url_logger_timeout branch June 27, 2023 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant