Skip to content

Commit 101c6c4

Browse files
committed
fix conn size
1 parent 8aaf842 commit 101c6c4

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

code/go/0chain.net/blobbercore/allocation/connection.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ func SaveFileChange(connectionID, pathHash, fileName string, cmd FileCommand, is
210210
Offset: offset,
211211
DataBytes: dataWritten,
212212
}, contentSize)
213+
if change.existingRef != nil {
214+
logging.Logger.Info("updateConnSize: ", zap.Int64("contentSize", contentSize), zap.Int64("currentSize", change.existingRef.Size))
215+
contentSize -= change.existingRef.Size
216+
} else {
217+
logging.Logger.Info("updateConnSize: ", zap.Int64("contentSize", contentSize))
218+
}
219+
if contentSize != 0 {
220+
UpdateConnectionObjSize(connectionID, contentSize)
221+
}
213222
} else {
214223
change.seqPQ.Push(seqpriorityqueue.UploadData{
215224
Offset: offset,

code/go/0chain.net/blobbercore/handler/file_command_update.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ func (cmd *UpdateFileCommand) ProcessContent(allocationObj *allocation.Allocatio
147147
if fileOutputData.ContentSize != cmd.fileChanger.Size {
148148
return result, common.NewError("upload_error", fmt.Sprintf("File size mismatch. Expected: %d, Actual: %d", cmd.fileChanger.Size, fileOutputData.ContentSize))
149149
}
150-
allocation.UpdateConnectionObjSize(connID, cmd.fileChanger.Size-cmd.existingFileRef.Size)
151150
}
152151

153152
if cmd.thumbFile != nil {

code/go/0chain.net/blobbercore/handler/file_command_upload.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ func (cmd *UploadFileCommand) ProcessContent(allocationObj *allocation.Allocatio
164164
if fileOutputData.ContentSize != cmd.fileChanger.Size {
165165
return result, common.NewError("upload_error", fmt.Sprintf("File size mismatch. Expected: %d, Actual: %d", cmd.fileChanger.Size, fileOutputData.ContentSize))
166166
}
167-
allocation.UpdateConnectionObjSize(connectionID, cmd.fileChanger.Size)
168167
}
169168

170169
if cmd.thumbFile != nil {

0 commit comments

Comments
 (0)