From 56e9235d7b76dfb64027beb11ffa8a3f2d88a8ad Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Thu, 11 Jul 2019 15:28:25 +0100 Subject: [PATCH] avoid FS call to get file length --- .../main/groovy/com/muwire/core/files/PersisterService.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy b/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy index 636c40ef..adadab3c 100644 --- a/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy +++ b/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy @@ -137,7 +137,7 @@ class PersisterService extends Service { private def toJson(File f, SharedFile sf) { def json = [:] json.file = Base64.encode DataUtil.encodei18nString(f.toString()) - json.length = f.length() + json.length = sf.getCachedLength() InfoHash ih = sf.getInfoHash() json.infoHash = Base64.encode ih.getRoot() json.pieceSize = sf.getPieceSize()