C
C#6mo ago
Sekoree

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
Sekoree
SekoreeOP6mo ago
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
Sekoree
SekoreeOP6mo ago
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)
No description
Sekoree
SekoreeOP6mo ago
This is an earlier try that is essentially the same as the code screenshot just without the CWs + console window
Sekoree
SekoreeOP6mo ago
I guess to add, my dev machine is running Win11 23H2 and the target is running some version of Win10
jiniux
jiniux6mo ago
are you sure that it is not the server the cause of the delay?
Sekoree
SekoreeOP6mo ago
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
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Sekoree
SekoreeOP6mo ago
I was just desperate at that point, with or without, its the same Yea one sec
Sekoree
SekoreeOP6mo ago
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
Sekoree
SekoreeOP6mo ago
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
Tvde1
Tvde16mo ago
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
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Sekoree
SekoreeOP6mo ago
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
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Sekoree
SekoreeOP6mo ago
That’s the plan
Sekoree
SekoreeOP6mo ago
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
Sekoree
SekoreeOP6mo ago
Also while being there I could replicate it on my PC, so this is where this is from
Want results from more Discord servers?
Add your server