projects
/
rawdog
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make socket timeout configurable.
[rawdog/.git]
/
rawdoglib
/
rawdog.py
diff --git
a/rawdoglib/rawdog.py
b/rawdoglib/rawdog.py
index c5b7e45cafcd01c7338676eb1015f5b393955d16..9982fbb570009c65f05c73859b8d71ff318dd61b 100644
(file)
--- a/
rawdoglib/rawdog.py
+++ b/
rawdoglib/rawdog.py
@@
-23,9
+23,6
@@
import os, time, sha, getopt, sys
from StringIO import StringIO
import timeoutsocket
from StringIO import StringIO
import timeoutsocket
-# Override the timeout set by feedparser.
-timeoutsocket.setDefaultSocketTimeout(30)
-
def format_time(secs, config):
"""Format a time and date nicely."""
t = time.localtime(secs)
def format_time(secs, config):
"""Format a time and date nicely."""
t = time.localtime(secs)
@@
-254,6
+251,7
@@
class Config:
"timeformat" : "%I:%M %p",
"userefresh" : 0,
"showfeeds" : 1,
"timeformat" : "%I:%M %p",
"userefresh" : 0,
"showfeeds" : 1,
+ "timeout" : 30,
}
def __getitem__(self, key): return self.config[key]
}
def __getitem__(self, key): return self.config[key]
@@
-297,6
+295,8
@@
class Config:
self["userefresh"] = int(l[1])
elif l[0] == "showfeeds":
self["showfeeds"] = int(l[1])
self["userefresh"] = int(l[1])
elif l[0] == "showfeeds":
self["showfeeds"] = int(l[1])
+ elif l[0] == "timeout":
+ self["timeout"] = int(l[1])
else:
raise ConfigError("Unknown config command: " + l[0])
else:
raise ConfigError("Unknown config command: " + l[0])
@@
-317,6
+317,8
@@
class Rawdog(Persistable):
def update(self, config, feedurl = None):
now = time.time()
def update(self, config, feedurl = None):
now = time.time()
+ timeoutsocket.setDefaultSocketTimeout(config["timeout"])
+
seenfeeds = {}
for (url, period) in config["feedslist"]:
seenfeeds[url] = 1
seenfeeds = {}
for (url, period) in config["feedslist"]:
seenfeeds[url] = 1