timeout and proper array

This commit is contained in:
j 2007-08-12 09:22:52 +00:00
parent b0981645e6
commit 635184f8ad

View file

@ -209,8 +209,11 @@ class Archive(SQLObject):
self.notifyFrontend('add', f.md5sum) self.notifyFrontend('add', f.md5sum)
def fillFrontend(self): def fillFrontend(self):
dto = socket.getdefaulttimeout()
socket.setdefaulttimeout(256)
data = read_url("%s/list" % self.baseUrlFrontend) data = read_url("%s/list" % self.baseUrlFrontend)
files = simplejson.loads(data) files = simplejson.loads(data)['files']
socket.setdefaulttimeout(dto)
md5sums = [str(f['md5sum']) for f in files.values()] md5sums = [str(f['md5sum']) for f in files.values()]
for f in ArchiveFile.select(NOT(IN(ArchiveFile.q.md5sum, md5sums))): for f in ArchiveFile.select(NOT(IN(ArchiveFile.q.md5sum, md5sums))):
self.notifyFrontend('add', f.md5sum) self.notifyFrontend('add', f.md5sum)