Close used db connections
This commit is contained in:
parent
f45afb3035
commit
dcae2ac323
|
@ -88,6 +88,7 @@ class ScrapeState():
|
||||||
c = connection.cursor()
|
c = connection.cursor()
|
||||||
c.execute("SELECT fileid FROM torrents")
|
c.execute("SELECT fileid FROM torrents")
|
||||||
all_hashes = c.fetchall()
|
all_hashes = c.fetchall()
|
||||||
|
connection.close()
|
||||||
for info_hash in all_hashes:
|
for info_hash in all_hashes:
|
||||||
info_hash = info_hash[0]
|
info_hash = info_hash[0]
|
||||||
url_param = binascii.a2b_hex(info_hash.encode())
|
url_param = binascii.a2b_hex(info_hash.encode())
|
||||||
|
@ -132,6 +133,7 @@ def download(filename):
|
||||||
c = connection.cursor()
|
c = connection.cursor()
|
||||||
c.execute("SELECT name FROM torrents WHERE fileid = :fileid", { 'fileid' : filename})
|
c.execute("SELECT name FROM torrents WHERE fileid = :fileid", { 'fileid' : filename})
|
||||||
name = c.fetchone()[0]
|
name = c.fetchone()[0]
|
||||||
|
connection.close()
|
||||||
return send_file("torrentFiles/" + filename, as_attachment=True, attachment_filename=name + ".torrent", conditional=True)
|
return send_file("torrentFiles/" + filename, as_attachment=True, attachment_filename=name + ".torrent", conditional=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,6 +172,7 @@ def search():
|
||||||
r = row[0:2] + (size(float(row[2])) , ) + row[3:]
|
r = row[0:2] + (size(float(row[2])) , ) + row[3:]
|
||||||
results.append(r)
|
results.append(r)
|
||||||
|
|
||||||
|
connection.close()
|
||||||
return render_template("result.html", results=results, categories=categories.categories, stats=scrapeState.stats)
|
return render_template("result.html", results=results, categories=categories.categories, stats=scrapeState.stats)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue