Bug fix: Lock MSPA update checking threads. Stops Pesterchum freezing when MSPA is down

This commit is contained in:
Kiooeht 2011-07-23 10:06:06 -07:00
parent 048caa527a
commit b9a48671fa

View file

@ -17,6 +17,7 @@ class MSPAChecker(QtGui.QWidget):
self, QtCore.SLOT('check_site()')) self, QtCore.SLOT('check_site()'))
self.check_site() self.check_site()
self.timer.start(1000*self.refreshRate) self.timer.start(1000*self.refreshRate)
self.lock = False
def save_state(self): def save_state(self):
try: try:
@ -45,12 +46,18 @@ class MSPAChecker(QtGui.QWidget):
def check_site(self): def check_site(self):
if not self.mainwindow.config.checkMSPA(): if not self.mainwindow.config.checkMSPA():
return return
if self.lock:
return
print "Checking MSPA updates..."
rss = None rss = None
must_save = False must_save = False
try: try:
self.lock = True
rss = feedparser.parse("http://www.mspaintadventures.com/rss/rss.xml") rss = feedparser.parse("http://www.mspaintadventures.com/rss/rss.xml")
except: except:
return return
finally:
self.lock = False
if len(rss.entries) == 0: if len(rss.entries) == 0:
return return
entries = sorted(rss.entries,key=(lambda x: mktime(x.updated_parsed))) entries = sorted(rss.entries,key=(lambda x: mktime(x.updated_parsed)))