From 221e525fe131ae8d217cfe2eaa7ee07271f4cffb Mon Sep 17 00:00:00 2001 From: Steve Lewis Date: Tue, 23 Jun 2015 18:22:02 -0700 Subject: [PATCH] Clear expired Django sessions regularly from DB A random minute in the 21st hour UTC, daily, was chosen arbitrarily. That it is run on a single arbitrary host from the set was done to prevent unnecessary work being done until Bug #1424705 provides us with a cleaner solution. Adjusted to run once per day just to be sure that the operation doesn't lock the table for a meaningful duration. Making this configurable or tunable does not seem to be necessary at this time. Change-Id: I87164926a4d6a65d3c9f733d625a2d4af91c2597 Closes-Bug: #1466126 --- tasks/horizon_db_setup.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tasks/horizon_db_setup.yml b/tasks/horizon_db_setup.yml index d1198faf..675991a1 100644 --- a/tasks/horizon_db_setup.yml +++ b/tasks/horizon_db_setup.yml @@ -46,3 +46,14 @@ tags: - horizon-db-sync - horizon-setup + +- name: Register DB session cleanup cron + cron: + name: "Clear out expired sessions" + minute: "{{ 58 | random(start=2) }}" + hour: 21 + job: "/usr/local/bin/horizon-manage.py clearsessions" + user: "{{ horizon_system_user_name }}" + state: present + tags: + - horizon-db-setup