feat: 添加块大小配置项

This commit is contained in:
krau
2024-10-12 13:36:17 +08:00
parent 0bd9b77856
commit edef778959
2 changed files with 7 additions and 4 deletions
+2
View File
@@ -10,6 +10,7 @@ import (
type Config struct {
Threads int `toml:"threads" mapstructure:"threads"`
Workers int `toml:"workers" mapstructure:"workers"`
ChunkSize int32 `toml:"chunk_size" mapstructure:"chunk_size"`
Temp tempConfig `toml:"temp" mapstructure:"temp"`
Log logConfig `toml:"log" mapstructure:"log"`
@@ -77,6 +78,7 @@ func Init() {
viper.SetDefault("threads", 3)
viper.SetDefault("workers", 3)
viper.SetDefault("chunk_size", 50*1024*1024)
viper.SetDefault("temp.base_path", "cache/")
viper.SetDefault("temp.cache_ttl", 3600)
+1
View File
@@ -28,6 +28,7 @@ func processPendingTask(task types.Task) error {
dest, err := message.Download(&telegram.DownloadOptions{
FileName: common.GetCacheFilePath(task.FileName),
Threads: config.Cfg.Threads,
ChunkSize: config.Cfg.ChunkSize,
// ProgressCallback: func(totalBytes, downloadedBytes int64) {},
})
if err != nil {