close more db connections

This commit is contained in:
j 2016-08-24 16:33:14 +02:00
parent 1ff3b1d9ee
commit c1d0e044c7

View file

@ -57,6 +57,7 @@ class Server(Resource):
sql = 'UPDATE encode SET status = ? WHERE site = ? AND status = ? AND modified < ?' sql = 'UPDATE encode SET status = ? WHERE site = ? AND status = ? AND modified < ?'
c.execute(sql, ('', site, 'active', active)) c.execute(sql, ('', site, 'active', active))
conn.commit() conn.commit()
conn.close()
return files return files
def is_available(self, oshash): def is_available(self, oshash):
@ -84,6 +85,7 @@ class Server(Resource):
modified = int(time.mktime(time.localtime())) modified = int(time.mktime(time.localtime()))
c.execute(u'UPDATE encode SET status = ?, modified = ? WHERE site = ? AND oshash = ?', (status, modified, site, oshash)) c.execute(u'UPDATE encode SET status = ?, modified = ? WHERE site = ? AND oshash = ?', (status, modified, site, oshash))
conn.commit() conn.commit()
conn.close()
def media_path(self, oshash): def media_path(self, oshash):
return os.path.join( return os.path.join(