Resolve race condition between multiple log archivers
This commit is contained in:
parent
8499612c4c
commit
a159bd3e77
2 changed files with 26 additions and 14 deletions
|
@ -248,3 +248,13 @@ def get_archivable_build():
|
|||
return RepositoryBuild.get(id=found_id)
|
||||
except RepositoryBuild.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
def mark_build_archived(build_uuid):
|
||||
""" Mark a build as archived, and return True if we were the ones who actually
|
||||
updated the row. """
|
||||
return (RepositoryBuild
|
||||
.update(logs_archived=True)
|
||||
.where(RepositoryBuild.uuid == build_uuid,
|
||||
RepositoryBuild.logs_archived == False)
|
||||
.execute()) > 0
|
||||
|
|
Reference in a new issue