abiczo / github-notifier

Github updates notifier for Linux
57 stars 8 forks source link

Fix 27 feed.status (thread) #29

Closed dotnetCarpenter closed 7 years ago

dotnetCarpenter commented 7 years ago

This PR fixes #27 by checking Internet connectivity in a background thread and setting a static variable. This variable is then checked before doing a request via feedparser.parse(feed_url), meaning that no work is being done while being offline. feed.status is guarded by a try block, since there is no guarantee that ConnectivityThread.isConnected is accurate while feedparser.parse is fetching a resource.

Queuing ConnectivityThread with GithubFeedUpdatherThread, might be able to guarantee connectivity while running feedparser.parse(feed_url).

This adds a little more complexity to github-notifier, but is more efficient that PR #28. However, I'm not sure the increased complexity is worth it, in this case.

It also adds a debug log level.

abiczo commented 7 years ago

Seems like this will have to be rebased on #28, right? Otherwise looks good to me. I'm assuming the connectivity thread commit will be removed here as well since you removed it from #28 too?