rongardF / tvdatafeed

A simple TradingView historical Data Downloader
MIT License
282 stars 156 forks source link

tvDatafeed.datafeed: _main_loop can freeze #21

Open rongardF opened 2 years ago

rongardF commented 2 years ago

The _main_loop can freeze indefinetly if the lock is never released because the acquire method does not have a timeout

rongardF commented 2 years ago

In practice it should not be a problem, because if application is shutdown then other threads will be stopped and they should release the lock which allows the _main_loop to continue running until end

andreagalloni92 commented 1 year ago

So, do you think this is still an open issue? Pull req?

rongardF commented 1 year ago

@andreagalloni92 I added timeouts to aquire method calls, but it can still be an issue if for example there is an exception raised while lock is aquired (then lock never gets released). The _main_loop uses contex manager now, but some other methods don't, because context manager does not support having timeout. It would be best to use context managers in those methods as well.

andreagalloni92 commented 1 year ago

Ok, gonna try to have a look (and possibly fx) at it as soon as I find some time. :) Thanks a lot for the response!