snapshots: save disk space by not automatically saving big objects (#47297)
gitea-wip/wcs/pipeline/head Build started... Details
gitea/wcs/pipeline/head Build queued... Details

This commit is contained in:
Frédéric Péters 2020-10-02 17:04:28 +02:00
parent f4886f5b0a
commit a7994a205b
1 changed files with 4 additions and 0 deletions

View File

@ -54,6 +54,10 @@ class Snapshot:
obj.comment = comment
obj.label = label
latest = cls.get_latest(obj.object_type, obj.object_id)
if label is None and len(obj.serialization) > 1000000:
# save disk space by not automatically saving big objects
# (typically workflows with embedded documents)
return
if label is not None or latest is None or obj.serialization != latest.serialization:
# save snapshot if there are changes or an explicit label was
# given.