From ec847ce613694306417e109a62fdb5dbc95d1aca Mon Sep 17 00:00:00 2001 From: Antoine Legrand Date: Fri, 17 Mar 2017 15:35:47 +0100 Subject: [PATCH] Switch from expire to delete redis log_entries --- data/buildlogs.py | 6 ++++++ test/testlogs.py | 8 ++++++++ workers/buildlogsarchiver.py | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/data/buildlogs.py b/data/buildlogs.py index 3f3336264..ba8b1ce78 100644 --- a/data/buildlogs.py +++ b/data/buildlogs.py @@ -81,6 +81,12 @@ class RedisBuildLogs(object): """ self._redis.expire(self._logs_key(build_id), ONE_DAY) + def delete_log_entries(self, build_id): + """ + Delete the log entry + """ + self._redis.delete(self._logs_key(build_id)) + @staticmethod def _status_key(build_id): return 'builds/%s/status' % build_id diff --git a/test/testlogs.py b/test/testlogs.py index 2781f5c8b..893c49b58 100644 --- a/test/testlogs.py +++ b/test/testlogs.py @@ -228,3 +228,11 @@ class TestBuildLogs(RedisBuildLogs): return None else: return super(TestBuildLogs, self).expire_log_entries(build_id) + + def delete_log_entries(self, build_id): + if build_id == self.test_build_id: + return + if not self.allow_delegate: + return None + else: + return super(TestBuildLogs, self).delete_log_entries(build_id) diff --git a/workers/buildlogsarchiver.py b/workers/buildlogsarchiver.py index c2ca6b586..0c17c7646 100644 --- a/workers/buildlogsarchiver.py +++ b/workers/buildlogsarchiver.py @@ -53,7 +53,7 @@ class ArchiveBuildLogsWorker(Worker): to_update.save() build_logs.expire_status(to_update.uuid) - build_logs.expire_log_entries(to_update.uuid) + build_logs.delete_log_entries(to_update.uuid) if __name__ == "__main__":