diff options
author | Sibi Prabakaran <sibi@psibi.in> | 2020-05-30 19:39:29 +0530 |
---|---|---|
committer | Sibi Prabakaran <sibi@psibi.in> | 2020-06-12 22:44:31 +0530 |
commit | f3e2d5a59983a5cb8c364dbac169fa5ef16ebb51 (patch) | |
tree | 7efb9636aebb6f9ddffb32e5b8b2fea7658ce21a /Commands.hs | |
parent | 878db39080607ba476ba8d8f547ad28259efb6a9 (diff) | |
download | xmobar-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 'Commands.hs')
0 files changed, 0 insertions, 0 deletions