Switch from expire to delete redis log_entries

This commit is contained in:
Antoine Legrand 2017-03-17 15:35:47 +01:00
parent f08e4921f2
commit ec847ce613
3 changed files with 15 additions and 1 deletions

View file

@ -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

View file

@ -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)

View file

@ -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__":