Every HttpClient request has a 5 second delay before execution
As the title says, it confuses me and the worst part, it works on my machine but not the one the Program has to run on.
Its a simple Avalonia app, a customizable grid with buttons that when pressed send a HTTP request.
Its a local network connection, plain HTTP
Is there any HttpClient option I'm missing, some kind of Timeout?
17 Replies
Here is a Video of what's happening , the really weird part is, from the response times everything seems fine. But the request doesn't actually go out hence the low time measures, it sort of does everything, then waits 5 second and actually everything happens including the UI Update
The CWs in this don't quite match the video cause I changed it a bit (spawned a new thread and called the sync Send method, but that changed nothing)
This is an earlier try that is essentially the same as the code screenshot just without the CWs + console window
I guess to add, my dev machine is running Win11 23H2 and the target is running some version of Win10
are you sure that it is not the server the cause of the delay?
They previously used a simple HTML page with a JS fetch that didn't have this issue, so i doubt its that
The server is a whatever "Bitfocus Companion" uses, probably just node express
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
I was just desperate at that point, with or without, its the same
Yea one sec
https://github.com/Sekoree/ButtonGridder
https://github.com/Sekoree/ButtonGridder/blob/3ca5d1d2f847b589b2ad87d6b59429df27ba76c1/ButtonGridder/Models/TriggerButtonModel.cs#L150
Parts a very ugly because time, should've been finished today
I'll try with a empty Ava app that just has a button that uses that code
GitHub
ButtonGridder/ButtonGridder/Models/TriggerButtonModel.cs at 3ca5d1d...
Customizable Grid with Buttons to trigger HTTP requests - Sekoree/ButtonGridder
Just for completion sake, the repor code as well
https://github.com/Sekoree/ButtonGridder/blob/master/DelayReproTest/ViewModels/MainWindowViewModel.cs
I'm not at the machine until a few hours, but someone there will try it in a bit
At first glance it does look like a slow api. Can you use postman or so to verify the api response time?
Otherwise i would look into it avalonia does async await in a different way where there would be time spent waiting
You could also do a profiling session
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
I tried both true/default and false, always the same. It’s was really just a desperation effort to add that.
When I’m there and have time I’ll see if I can profile a bit, also I made a second Test version that uses Commands instead of directly binding to the method, maybe that helps
Maybe something on the windows side gets tripped up as well, maybe it’s AOT but it’s all just guesswork and it’s probably just something incredibly simple
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
That’s the plan
I'm still insanely confused by this, for the time being I just switched to calling cURL.
I made a mini program that just created a HttpClient and then called the URL, same result
Ran it through dotTrace but all I can I see it that it waiting 4.2 seconds on a Montor.Wait internally.
Maybe its really just BitFocus Companion's way of how it uses Node's Express or something, I'll try with a local instance soon, but its really weird how every other way works fine, except the call from my code
Also while being there I could replicate it on my PC, so this is where this is from