move math function inside the sql statement
This commit is contained in:
9
ppf.py
9
ppf.py
@@ -127,15 +127,15 @@ def proxyleech(sqlite, rows):
|
||||
|
||||
hash = hashlib.md5(''.join(uniques)).hexdigest()
|
||||
|
||||
## empty list of proxies: increment error by two
|
||||
## empty list of proxies: multiply error by two
|
||||
if not len(uniques): row[2] = (row[2] * 2)
|
||||
## same proxy list: increment error by one
|
||||
elif hash == row[1]: row[2] = (row[2] + 1)
|
||||
## proxylist was updated: error is zero
|
||||
else: row[2] = 0
|
||||
|
||||
check_time = (time.time() + 3600 + (3600 * row[2]))
|
||||
sqlite.execute('UPDATE uris SET error=?,hash=?,check_time=? where url=?', (row[2],hash, check_time,row[0]))
|
||||
#check_time = (time.time() + 3600 + (3600 * row[2]))
|
||||
sqlite.execute('UPDATE uris SET error=?,hash=?,check_time=? where url=?', (row[2],hash, time.time(),row[0]))
|
||||
sqlite.commit()
|
||||
|
||||
if not row[1] or row[2] > 0: return
|
||||
@@ -183,7 +183,8 @@ if __name__ == '__main__':
|
||||
while True:
|
||||
try:
|
||||
## any site that needs to be checked ?
|
||||
rows = [ [i[0],i[1],i[2]] for i in sqlite.execute('SELECT url,hash,error FROM uris WHERE (check_time<? AND error<?) ORDER BY RANDOM() LIMIT 25', (time.time(), 10)).fetchall() ]
|
||||
rows = [ [i[0],i[1],i[2]] for i in sqlite.execute('SELECT url,hash,error FROM uris WHERE (check_time+?+(error*?) <?) ORDER BY RANDOM() LIMIT 25', (config.checktime, config.perfail_checktime, time.time())).fetchall() ]
|
||||
|
||||
if len(rows): proxyleech(sqlite,rows)
|
||||
## search for new website during free time
|
||||
elif config.search: proxyfind(sqlite)
|
||||
|
||||
Reference in New Issue
Block a user