maded2 / plotng

PlotNG - plotting utility for Chia.Net
Apache License 2.0
128 stars 24 forks source link

Fixes UI race conditions, and adds a permanent http client #41

Closed squizzling closed 3 years ago

squizzling commented 3 years ago

tcell 2.2.0 contains a bug with exiting that causes a deadlock in the UI when run under Windows. This was fixed in 2.2.1, however there is also a race condition which is fixed in 2.3.1. This also commits go.sum, which should be present. There is no guarantee that a dependency won't be compromised in future, so this will lock everything to explicit commits.

This also splits how data is retrieved. You're only meant to edit widgets from the main tview loop. This does the http access on the worker routine, then pushes the updates in to the tview loop. QueueUpdateDraw is sync and will wait for the function to complete before resuming.

Finally we add a top level http.Client. Creating a new client every time will stop connection re-use.

maded2 commented 3 years ago

' Finally we add a top level http.Client. Creating a new client every time will stop connection re-use. '

Actually, since I added multiple plotter support. I dont want to re-use the same http client. Can you remove this part as I am fine with the rest of the PR. Thanks for your contributions.

squizzling commented 3 years ago

I could, but what's the concern with sharing a client? A client basically provides settings and connection reuse / pooling.

maded2 commented 3 years ago

actually, you are correct. Let's keep the global http client.

squizzling commented 3 years ago

Groovy. Please merge, and I'll start finishing up the next PR.