fix division by zero

main
Max Ignatenko 2024-02-19 18:34:26 +00:00
parent e8ca4e808e
commit a0934c360e
1 changed files with 4 additions and 2 deletions

View File

@ -101,8 +101,10 @@ func (s *Scheduler) fillQueue(ctx context.Context) error {
if err := s.db.Find(&remotes).Error; err != nil { if err := s.db.Find(&remotes).Error; err != nil {
return fmt.Errorf("failed to get the list of PDSs: %w", err) return fmt.Errorf("failed to get the list of PDSs: %w", err)
} }
perPDSLimit := 0
perPDSLimit := maxQueueLen * 2 / len(remotes) if len(remotes) > 0 {
perPDSLimit = maxQueueLen * 2 / len(remotes)
}
for _, remote := range remotes { for _, remote := range remotes {
repos := []repo.Repo{} repos := []repo.Repo{}