From 8ec1091dba3e33bdc29fae78fbb53b3fbad78374 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= <sybren@stuvel.eu>
Date: Tue, 16 May 2017 18:56:48 +0200
Subject: [PATCH] Vacuum SQLite database at startup.

---
 CHANGELOG.md                             | 5 +++++
 flamenco_worker/upstream_update_queue.py | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fdec854b..df400b91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
 This file logs the changes that are actually interesting to users (new features,
 changed functionality, fixed bugs).
 
+## Version 2.0.5 (in development)
+
+- Vacuum SQLite database at startup.
+
+
 ## Version 2.0.4 (released 201-05-09)
 
 - Fixed bug in writing ~/.flamenco-worker.cfg
diff --git a/flamenco_worker/upstream_update_queue.py b/flamenco_worker/upstream_update_queue.py
index f9aac794..813d2eb5 100644
--- a/flamenco_worker/upstream_update_queue.py
+++ b/flamenco_worker/upstream_update_queue.py
@@ -38,6 +38,9 @@ class TaskUpdateQueue:
         # We don't need to create a primary key; we use the implicit 'rowid' column.
         self._db.execute('CREATE TABLE IF NOT EXISTS fworker_queue(url TEXT, payload BLOB)')
 
+        # Start with a more-or-less compact database.
+        self._db.execute('VACUUM')
+
     def _disconnect_db(self):
         self._log.info('Disconnecting from database %s', self.db_fname)
         self._db.close()
-- 
GitLab