diff --git a/indexer.py b/indexer.py index fffe497..9f1e7d7 100644 --- a/indexer.py +++ b/indexer.py @@ -88,6 +88,7 @@ class ScrapeState(): c = connection.cursor() c.execute("SELECT fileid FROM torrents") all_hashes = c.fetchall() + connection.close() for info_hash in all_hashes: info_hash = info_hash[0] url_param = binascii.a2b_hex(info_hash.encode()) @@ -132,6 +133,7 @@ def download(filename): c = connection.cursor() c.execute("SELECT name FROM torrents WHERE fileid = :fileid", { 'fileid' : filename}) name = c.fetchone()[0] + connection.close() 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:] results.append(r) + connection.close() return render_template("result.html", results=results, categories=categories.categories, stats=scrapeState.stats)