( id string, ctx context.Context, files []TaskElement, progress ProgressTracker, ignoreErrors bool, )
| 78 | } |
| 79 | |
| 80 | func NewBatchTGFileTask( |
| 81 | id string, |
| 82 | ctx context.Context, |
| 83 | files []TaskElement, |
| 84 | progress ProgressTracker, |
| 85 | ignoreErrors bool, |
| 86 | ) *Task { |
| 87 | task := &Task{ |
| 88 | ID: id, |
| 89 | ctx: ctx, |
| 90 | elems: files, |
| 91 | Progress: progress, |
| 92 | downloaded: atomic.Int64{}, |
| 93 | totalSize: func() int64 { |
| 94 | var total int64 |
| 95 | for _, elem := range files { |
| 96 | total += elem.File.Size() |
| 97 | } |
| 98 | return total |
| 99 | }(), |
| 100 | processing: make(map[string]TaskElementInfo), |
| 101 | IgnoreErrors: ignoreErrors, |
| 102 | processingMu: sync.RWMutex{}, |
| 103 | failed: make(map[string]error), |
| 104 | } |
| 105 | return task |
| 106 | } |
no test coverage detected