feat: Upload speed booster
This commit is contained in:
parent
c611508c92
commit
e7cb4b8cf2
@ -26,6 +26,8 @@ import java.io.RandomAccessFile;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class FileUploadOperation {
|
||||
|
||||
private static class UploadCachedResult {
|
||||
@ -38,6 +40,7 @@ public class FileUploadOperation {
|
||||
private boolean nextPartFirst;
|
||||
private int operationGuid;
|
||||
private static final int minUploadChunkSize = 128;
|
||||
private static final int minUploadChunkSizeBoost = 512;
|
||||
private static final int minUploadChunkSlowNetworkSize = 32;
|
||||
private static final int initialRequestsCount = 8;
|
||||
private static final int initialRequestsSlowNetworkCount = 1;
|
||||
@ -283,7 +286,7 @@ public class FileUploadOperation {
|
||||
if (AccountInstance.getInstance(currentAccount).getUserConfig().isPremium() && totalFileSize > FileLoader.DEFAULT_MAX_FILE_SIZE) {
|
||||
maxUploadParts = MessagesController.getInstance(currentAccount).uploadMaxFilePartsPremium;
|
||||
}
|
||||
uploadChunkSize = (int) Math.max(slowNetwork ? minUploadChunkSlowNetworkSize : minUploadChunkSize, (totalFileSize + 1024L * maxUploadParts - 1) / (1024L * maxUploadParts));
|
||||
uploadChunkSize = (int) Math.max(slowNetwork ? minUploadChunkSlowNetworkSize : NekoConfig.enhancedFileLoader.Bool() ? minUploadChunkSizeBoost : minUploadChunkSize, (totalFileSize + 1024L * maxUploadParts - 1) / (1024L * maxUploadParts));
|
||||
if (1024 % uploadChunkSize != 0) {
|
||||
int chunkSize = 64;
|
||||
while (uploadChunkSize > chunkSize) {
|
||||
|
@ -148,5 +148,5 @@
|
||||
<string name="disablePremiumStickerAnimation">禁用会员贴纸动画</string>
|
||||
<string name="DatacenterStatusAbout">检查 Telegram 的**数据中心**的状态。</string>
|
||||
<string name="DatacenterStatus">数据中心状态</string>
|
||||
<string name="enhancedFileLoader">加速下载</string>
|
||||
<string name="enhancedFileLoader">加速上传和下载</string>
|
||||
</resources>
|
||||
|
@ -150,7 +150,7 @@
|
||||
<string name="MutualContactDescription">This contact is a mutual contact.</string>
|
||||
<string name="DatacenterStatusAbout">Check the status of Telegram\'s **datacenters**.</string>
|
||||
<string name="DatacenterStatus">Datacenter status</string>
|
||||
<string name="enhancedFileLoader">Enhance Download speed</string>
|
||||
<string name="enhancedFileLoader">Enhance Upload and Download speed</string>
|
||||
<string name="mapDriftingFixForGoogleMaps">Fix Google Maps drifting in China</string>
|
||||
<string name="useOSMDroidMap">Use OSMDroid Map</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user