Make Org-feed wget timeout
Making wget timeout in org-feed
Org feed is great for my feeds reading. Sometimes though feeds are unresponsive. If you use the default retrieve method of org-feed you have just to wait ten seconds for feed.
The default method is rather slow though, so I preferred the good old
wget utility.
Setting
(setq org-feed-retrieve-method 'wget)
will use the default retry policy of wget for each feed (which means
hanging for a long time).
Org-feed is very malleable though, so this will solve the issue:
(setq org-feed-retrieve-method
(lambda (url)
(message "%S" url)
(ignore-errors (kill-buffer org-feed-buffer))
(call-process "wget" nil org-feed-buffer nil "-q" "--tries=2" "--timeout=3" "-O" "-" url)
org-feed-buffer))
In practice we are just adding two flags to wget:
--timeout=3: after 3 seconds of hanging close the connection--tries=2: retry at most 2 times
This speed up my feeds gathering quite a lot.
Hopefully it helps somebody else.