File index

This commit is contained in:
2025-11-12 22:09:13 +08:00
parent ce715cd6b0
commit e2b2bdd262
19 changed files with 2189 additions and 62 deletions

View File

@@ -615,7 +615,14 @@ public class PersistentTaskService(
var chunkSize = request.ChunkSize ?? 1024 * 1024 * 5; // 5MB default
var chunksCount = (int)Math.Ceiling((double)request.FileSize / chunkSize);
// Use the default pool if no pool is specified, or find first available pool
// If the second chunk is too small (less than 1MB), merge it with the first chunk
if (chunksCount == 2 && (request.FileSize - chunkSize) < 1024 * 1024)
{
chunksCount = 1;
chunkSize = request.FileSize;
}
// Use the default pool if no pool is specified, or find the first available pool
var poolId = request.PoolId ?? await GetFirstAvailablePoolIdAsync();
var uploadTask = new PersistentUploadTask
@@ -632,6 +639,7 @@ public class PersistentTaskService(
EncryptPassword = request.EncryptPassword,
ExpiredAt = request.ExpiredAt,
Hash = request.Hash,
Path = request.Path,
AccountId = accountId,
Status = TaskStatus.InProgress,
UploadedChunks = [],
@@ -1132,4 +1140,4 @@ public class RecentActivity
public double Progress { get; set; }
}
#endregion
#endregion