From d1535febb970af189ead99ff4d1705a30b3a365b Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Tue, 10 Sep 2013 13:54:21 +0200 Subject: [PATCH] Make the varnish queue id configurable This is required if the queue is dropped and recreated in pgq as it gets a new id, which needs to be used when viewing the current status of the queue in the admin interface. --- pgweb/core/views.py | 2 +- pgweb/settings.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pgweb/core/views.py b/pgweb/core/views.py index c1200a74..9a5c670d 100644 --- a/pgweb/core/views.py +++ b/pgweb/core/views.py @@ -206,7 +206,7 @@ def admin_purge(request): # Fetch list of latest purges curs = connection.cursor() - curs.execute("SELECT ev_time, ev_type, ev_data FROM pgq.event_1 WHERE ev_type IN ('P', 'X') ORDER BY ev_time DESC LIMIT 20") + curs.execute("SELECT ev_time, ev_type, ev_data FROM pgq.event_%s WHERE ev_type IN ('P', 'X') ORDER BY ev_time DESC LIMIT 20" % settings.VARNISH_QUEUE_ID) latest = [{'t': r[0], 'ty': r[1], 'u': r[2]} for r in curs.fetchall()] return render_to_response('core/admin_purge.html', { diff --git a/pgweb/settings.py b/pgweb/settings.py index b4164d6e..8930dba6 100644 --- a/pgweb/settings.py +++ b/pgweb/settings.py @@ -156,6 +156,7 @@ FRONTEND_SERVERS=() # A tuple containing the FTP_MASTERS=() # A tuple containing the *IP addresses* of all machines # trusted to upload ftp structure data VARNISH_PURGERS=() # Extra servers that can do varnish purges through our queue +VARNISH_QUEUE_ID=1 # pgq queue id used for varnish purging ARCHIVES_SEARCH_SERVER="archives.postgresql.org" # Where to post REST request for archives search # Load local settings overrides