I had kind of a similar problem with speed in my app and this is maybe
working better for me (testing is not my forte)
for x in range(self.MAX_CRAWL_THREADS+1):
self.con.append(
[MySQLdb.connect('localhost','u','p','spiderpydb',3306),0])
def getconnection(self):
ins = [z[1] for z in self.con]
for x in self.con:
if x[1] == 0:
y = max(ins)+1
x[1] = y
return x
def resetconnection(self,threadnumber):
for x in self.con:
if x[1] == threadnumber:
x[1] = 0
connection = self.getconnection()
cu = connection[0].cursor()
sql_us = "SELECT id FROM user WHERE name = '%s'" % self.user
rws = cu.execute(sql_us)
user = cu.fetchone()
cu.executemany("INSERT INTO que (address,time,user_id) VALUES
(%s,%s,%s)", [(ref,tn,user[0]) for ref in href ])
cu.close()
self.resetconnection(connection[1])
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---