Patched a small bug in storeSessionsCache()
This commit is contained in:
parent
38e6e15a26
commit
6a7f175a60
|
@ -2107,25 +2107,23 @@ class Database:
|
||||||
|
|
||||||
for row in inserts:
|
for row in inserts:
|
||||||
threshold = []
|
threshold = []
|
||||||
session_records = []
|
|
||||||
threshold.append(row[-1]-THRESHOLD)
|
threshold.append(row[-1]-THRESHOLD)
|
||||||
threshold.append(row[-1]+THRESHOLD)
|
threshold.append(row[-1]+THRESHOLD)
|
||||||
cursor.execute(select_sessionscache, threshold)
|
cursor.execute(select_sessionscache, threshold)
|
||||||
for r in cursor:
|
session_records = cursor.fetchall()
|
||||||
if r: session_records.append(r[0])
|
|
||||||
num = len(session_records)
|
num = len(session_records)
|
||||||
if (num == 1):
|
if (num == 1):
|
||||||
id = session_records[0] #grab the sessionId
|
id = session_records[0][0] #grab the sessionId
|
||||||
# Try to do the update first:
|
# Try to do the update first:
|
||||||
#print "DEBUG: found 1 record to update"
|
#print "DEBUG: found 1 record to update"
|
||||||
update_mid = row + row[-1:]
|
update_mid = row + row[-1:]
|
||||||
cursor.execute(select_sessionscache_mid, update_mid[-2:])
|
cursor.execute(select_sessionscache_mid, update_mid[-2:])
|
||||||
mid = cursor.fetchone()
|
mid = len(cursor.fetchall())
|
||||||
if mid:
|
if (mid == 0):
|
||||||
update_startend = row[-1:] + row + threshold
|
update_startend = row[-1:] + row + threshold
|
||||||
cursor.execute(select_sessionscache_start, update_startend[-3:])
|
cursor.execute(select_sessionscache_start, update_startend[-3:])
|
||||||
start = cursor.fetchone()
|
start = len(cursor.fetchall())
|
||||||
if start:
|
if (start == 0):
|
||||||
#print "DEBUG:", start, " start record found. Update stats and start time"
|
#print "DEBUG:", start, " start record found. Update stats and start time"
|
||||||
cursor.execute(update_sessionscache_end, update_startend)
|
cursor.execute(update_sessionscache_end, update_startend)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user