Skip to content

Commit

Permalink
restore size diff calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Sep 19, 2023
1 parent b821d1a commit cfec3a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func (fs *Decomposedfs) PreFinishResponseCallback(hook tusd.HookEvent) error {
}
}

var sizeDiff int64
sizeDiff := info.Size - n.Blobsize
if !fs.o.AsyncFileUploads {
// handle postprocessing synchronously
err = upload.Finalize(ctx, fs.blobstore, info, n) // moving or copying the blob only reads the blobid, no need to change the revision nodes nodeid
Expand Down
7 changes: 4 additions & 3 deletions pkg/storage/utils/decomposedfs/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func AddRevisionToNode(ctx context.Context, lu *lookup.Lookup, info tusd.FileInf
} else {
nodeHandle, err = openExistingNode(ctx, lu, n)
if err != nil {
log.Error().Err(err).Msg("could open existing node")
log.Error().Err(err).Msg("could not open existing node")
return nil, err
}
log.Info().Str("lockfile", nodeHandle.Name()).Msg("got lock file from openExistingNode")
Expand All @@ -230,7 +230,7 @@ func AddRevisionToNode(ctx context.Context, lu *lookup.Lookup, info tusd.FileInf
}
nodeHandle, err = openExistingNode(ctx, lu, n)
if err != nil {
log.Error().Err(err).Msg("could open existing node")
log.Error().Err(err).Msg("could not open existing node")
return nil, err
}
log.Info().Str("lockfile", nodeHandle.Name()).Msg("got lock file from openExistingNode")
Expand Down Expand Up @@ -459,6 +459,8 @@ func SetNodeToRevision(ctx context.Context, lu *lookup.Lookup, n *node.Node, rev
return 0, err
}

sizeDiff := revisionNode.Blobsize - n.Blobsize

n.BlobID = revisionNode.BlobID
n.Blobsize = revisionNode.Blobsize

Expand All @@ -483,7 +485,6 @@ func SetNodeToRevision(ctx context.Context, lu *lookup.Lookup, n *node.Node, rev
return 0, errors.Wrap(err, "Decomposedfs: could not write metadata")
}

sizeDiff := revisionNode.Blobsize - n.Blobsize
return sizeDiff, nil
}

Expand Down

0 comments on commit cfec3a6

Please sign in to comment.