Adjust config names to per minute
This commit is contained in:
@@ -81,7 +81,7 @@ func MainApp(configPath string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rateLimiter := http.NewRateLimiter(config.GetAPIRateLimitPerSecond())
|
rateLimiter := http.NewRateLimiter(config.GetAPIRateLimitPerMinute())
|
||||||
|
|
||||||
apiClient := http.NewHTTPClient(
|
apiClient := http.NewHTTPClient(
|
||||||
config.GetToken(),
|
config.GetToken(),
|
||||||
@@ -127,7 +127,7 @@ func MainApp(configPath string) {
|
|||||||
}
|
}
|
||||||
defer workerPool.Release()
|
defer workerPool.Release()
|
||||||
|
|
||||||
torrentsRateLimiter := http.NewRateLimiter(config.GetTorrentsRateLimitPerSecond())
|
torrentsRateLimiter := http.NewRateLimiter(config.GetTorrentsRateLimitPerMinute())
|
||||||
|
|
||||||
rd := realdebrid.NewRealDebrid(
|
rd := realdebrid.NewRealDebrid(
|
||||||
apiClient,
|
apiClient,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ type ConfigInterface interface {
|
|||||||
EnableRepair() bool
|
EnableRepair() bool
|
||||||
EnableRetainFolderNameExtension() bool
|
EnableRetainFolderNameExtension() bool
|
||||||
EnableRetainRDTorrentName() bool
|
EnableRetainRDTorrentName() bool
|
||||||
GetAPIRateLimitPerSecond() int
|
GetAPIRateLimitPerMinute() int
|
||||||
GetApiTimeoutSecs() int
|
GetApiTimeoutSecs() int
|
||||||
GetConfig() ZurgConfig
|
GetConfig() ZurgConfig
|
||||||
GetDirectories() []string
|
GetDirectories() []string
|
||||||
@@ -31,7 +31,7 @@ type ConfigInterface interface {
|
|||||||
GetRepairEveryMins() int
|
GetRepairEveryMins() int
|
||||||
GetRetriesUntilFailed() int
|
GetRetriesUntilFailed() int
|
||||||
GetToken() string
|
GetToken() string
|
||||||
GetTorrentsRateLimitPerSecond() int
|
GetTorrentsRateLimitPerMinute() int
|
||||||
GetUsername() string
|
GetUsername() string
|
||||||
GetVersion() string
|
GetVersion() string
|
||||||
MeetsConditions(directory, torrentName string, torrentSize int64, torrentIDs, fileNames []string, fileSizes []int64, mediaInfos []*ffprobe.ProbeData) bool
|
MeetsConditions(directory, torrentName string, torrentSize int64, torrentIDs, fileNames []string, fileSizes []int64, mediaInfos []*ffprobe.ProbeData) bool
|
||||||
@@ -48,7 +48,7 @@ type ZurgConfig struct {
|
|||||||
Version string `yaml:"zurg" json:"-"`
|
Version string `yaml:"zurg" json:"-"`
|
||||||
Token string `yaml:"token" json:"-"`
|
Token string `yaml:"token" json:"-"`
|
||||||
|
|
||||||
APIRateLimitPerSecond int `yaml:"api_rate_limit_per_second" json:"api_rate_limit_per_second"`
|
APIRateLimitPerMinute int `yaml:"api_rate_limit_per_second" json:"api_rate_limit_per_second"`
|
||||||
ApiTimeoutSecs int `yaml:"api_timeout_secs" json:"api_timeout_secs"`
|
ApiTimeoutSecs int `yaml:"api_timeout_secs" json:"api_timeout_secs"`
|
||||||
AutoAnalyzeNewTorrents bool `yaml:"auto_analyze_new_torrents" json:"auto_analyze_new_torrents"`
|
AutoAnalyzeNewTorrents bool `yaml:"auto_analyze_new_torrents" json:"auto_analyze_new_torrents"`
|
||||||
CacheNetworkTestResults bool `yaml:"cache_network_test_results" json:"cache_network_test_results"`
|
CacheNetworkTestResults bool `yaml:"cache_network_test_results" json:"cache_network_test_results"`
|
||||||
@@ -76,7 +76,7 @@ type ZurgConfig struct {
|
|||||||
RetainRDTorrentName bool `yaml:"retain_rd_torrent_name" json:"retain_rd_torrent_name"`
|
RetainRDTorrentName bool `yaml:"retain_rd_torrent_name" json:"retain_rd_torrent_name"`
|
||||||
RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"`
|
RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"`
|
||||||
ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"`
|
ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"`
|
||||||
TorrentsRateLimitPerSecond int `yaml:"torrents_rate_limit_per_second" json:"torrents_rate_limit_per_second"`
|
TorrentsRateLimitPerMinute int `yaml:"torrents_rate_limit_per_second" json:"torrents_rate_limit_per_second"`
|
||||||
Username string `yaml:"username" json:"username"`
|
Username string `yaml:"username" json:"username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,16 +243,16 @@ func (z *ZurgConfig) ShouldHideBrokenTorrents() bool {
|
|||||||
return z.HideBrokenTorrents
|
return z.HideBrokenTorrents
|
||||||
}
|
}
|
||||||
|
|
||||||
func (z *ZurgConfig) GetAPIRateLimitPerSecond() int {
|
func (z *ZurgConfig) GetAPIRateLimitPerMinute() int {
|
||||||
if z.APIRateLimitPerSecond == 0 {
|
if z.APIRateLimitPerMinute == 0 {
|
||||||
return 250
|
return 250
|
||||||
}
|
}
|
||||||
return z.APIRateLimitPerSecond
|
return z.APIRateLimitPerMinute
|
||||||
}
|
}
|
||||||
|
|
||||||
func (z *ZurgConfig) GetTorrentsRateLimitPerSecond() int {
|
func (z *ZurgConfig) GetTorrentsRateLimitPerMinute() int {
|
||||||
if z.TorrentsRateLimitPerSecond == 0 {
|
if z.TorrentsRateLimitPerMinute == 0 {
|
||||||
return 1
|
return 60
|
||||||
}
|
}
|
||||||
return z.TorrentsRateLimitPerSecond
|
return z.TorrentsRateLimitPerMinute
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ type RateLimiter struct {
|
|||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRateLimiter(apiRateLimitPerSecond int) *RateLimiter {
|
func NewRateLimiter(rateLimitPerMinute int) *RateLimiter {
|
||||||
return &RateLimiter{
|
return &RateLimiter{
|
||||||
ticker: time.NewTicker(time.Second / time.Duration(apiRateLimitPerSecond)),
|
ticker: time.NewTicker(time.Minute / time.Duration(rateLimitPerMinute)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user