summaryrefslogtreecommitdiffhomepage
path: root/xmobar.cabal
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2020-05-30 19:39:29 +0530
committerSibi Prabakaran <sibi@psibi.in>2020-06-12 22:44:31 +0530
commitf3e2d5a59983a5cb8c364dbac169fa5ef16ebb51 (patch)
tree7efb9636aebb6f9ddffb32e5b8b2fea7658ce21a /xmobar.cabal
parent878db39080607ba476ba8d8f547ad28259efb6a9 (diff)
downloadxmobar-f3e2d5a59983a5cb8c364dbac169fa5ef16ebb51.tar.gz
xmobar-f3e2d5a59983a5cb8c364dbac169fa5ef16ebb51.tar.bz2
Optimize weather plugin by reusing manager and other refactors
As documented in the http-client library, calling newManager is an expensive operation: ``` Creating a new Manager is a relatively expensive operation, you are advised to share a single Manager between requests instead. ``` But inspite of the haddocks in xmobar claiming that once 'Manager' is created, it will be used throughout the monitor is not true. Because for every call of `startWeather` a new manager is being created. Also I removed the option in WeatherOpts because even if it is false, it will be ultimately created in `getData` function. Also without using a manager - the plugin won't really work. So, I don't think there is any reason for this option to exist. I have introduced a new dependency http-client-tls to use the shared global manager so that we reuse the same manager every time. This simplifies a lot of code. Note that this is not really a new dependency because http-conduit already depends on it transitively.
Diffstat (limited to 'xmobar.cabal')
-rw-r--r--xmobar.cabal2
1 files changed, 1 insertions, 1 deletions
diff --git a/xmobar.cabal b/xmobar.cabal
index 5dcd770..d52c460 100644
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -263,7 +263,7 @@ library
if flag(with_weather) || flag(all_extensions)
other-modules: Xmobar.Plugins.Monitors.Weather
cpp-options: -DWEATHER
- build-depends: http-conduit, http-types
+ build-depends: http-conduit, http-types, http-client-tls
if flag(with_uvmeter)
other-modules: Xmobar.Plugins.Monitors.UVMeter