Skip to content

Commit

Permalink
commit changes after delete command
Browse files Browse the repository at this point in the history
Commit changes after rows have been deleted. Timeout increased to 100s.
  • Loading branch information
cpe committed Aug 18, 2015
1 parent 3b04cff commit 959b37e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import sys
import sqlite3
from datetime import datetime
from dateutil import parser
Expand Down Expand Up @@ -316,6 +317,10 @@ def delete_species(self, speciesid):
deleted_species.append(row[0])
cursor.execute("DELETE FROM Transitions WHERE T_Name = ?", (row[0], ))
cursor.execute("DELETE FROM Partitionfunctions WHERE PF_Name = ?", (row[0], ))

self.conn.commit()
cursor.close()

return deleted_species

##********************************************************************
Expand Down Expand Up @@ -742,7 +747,9 @@ def update_database(self, add_nodes = None, insert_only = False, update_only = F
if request.status == 204:
if delete_archived:
print " -- ENTRY ARCHIVED AND WILL BE DELETED -- "
self.delete_species(speciesid)
del_specie = self.delete_species(row[1])
if len(del_specie) > 0:
print "\r Done"
else:
print " -- ENTRY ARCHIVED -- "
continue
Expand All @@ -753,9 +760,10 @@ def update_database(self, add_nodes = None, insert_only = False, update_only = F
print " -- TIMEOUT: Could not check entry -- "
continue

except Exception, e:
errorcode = e.strerror
except:
changedate = None
print "Could not retrieve information - Unexpected error:", sys.exc_info()[0]
continue

tstamp = parser.parse(row[3] + " GMT")
if changedate is None:
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

#DATABASE_FILE = "/var/www/static/cdms/cdms_lite/cdms_lite_private.db"
# Timeout for queries
TIMEOUT = 30
TIMEOUT = 100

0 comments on commit 959b37e

Please sign in to comment.