From ace214b035d7e1913047a3318904f07efad84ad8 Mon Sep 17 00:00:00 2001 From: tomleb Date: Sun, 4 Jun 2017 18:43:52 -0400 Subject: [PATCH] Reindex table for sukebei and nyaa (Fix #914) (#916) --- deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py | 2 +- .../roles/elasticsearch/templates/reindex_triggers.sql.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py b/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py index ff5aa206..fa07bce4 100644 --- a/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py +++ b/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py @@ -23,7 +23,7 @@ pgconn = psycopg2.connect(dbparams) cur = pgconn.cursor() # We MUST use NO QUERY CACHE because the values are insert on triggers and # not through pgppool. -cur.execute("""/*NO QUERY CACHE*/ SELECT reindex_torrents_id, torrent_id, action FROM reindex_torrents""") +cur.execute('/*NO QUERY CACHE*/ SELECT reindex_torrents_id, torrent_id, action FROM reindex_{torrent_tablename}'.format(torrent_tablename=torrent_tablename)) fetches = cur.fetchmany(CHUNK_SIZE) while fetches: diff --git a/deploy/ansible/roles/elasticsearch/templates/reindex_triggers.sql.j2 b/deploy/ansible/roles/elasticsearch/templates/reindex_triggers.sql.j2 index 8a8f4e41..8f144756 100644 --- a/deploy/ansible/roles/elasticsearch/templates/reindex_triggers.sql.j2 +++ b/deploy/ansible/roles/elasticsearch/templates/reindex_triggers.sql.j2 @@ -3,7 +3,7 @@ CREATE TYPE torrents_action AS ENUM ('index', 'delete'); -CREATE TABLE IF NOT EXISTS reindex_torrents ( +CREATE TABLE IF NOT EXISTS reindex_{{ nyaapantsu_torrent_tablename }} ( reindex_torrents_id SERIAL, torrent_id int, action torrents_action