startReadWorkers will start the worker pool
()
| 98 | |
| 99 | // startReadWorkers will start the worker pool |
| 100 | func (r *Handle) startReadWorkers() { |
| 101 | if r.workers > 0 { |
| 102 | return |
| 103 | } |
| 104 | totalWorkers := r.cacheFs().opt.TotalWorkers |
| 105 | |
| 106 | if r.cacheFs().plexConnector.isConfigured() { |
| 107 | if !r.cacheFs().plexConnector.isConnected() { |
| 108 | err := r.cacheFs().plexConnector.authenticate() |
| 109 | if err != nil { |
| 110 | fs.Errorf(r, "failed to authenticate to Plex: %v", err) |
| 111 | } |
| 112 | } |
| 113 | if r.cacheFs().plexConnector.isConnected() { |
| 114 | totalWorkers = 1 |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | r.scaleWorkers(totalWorkers) |
| 119 | } |
| 120 | |
| 121 | // scaleWorkers will increase the worker pool count by the provided amount |
| 122 | func (r *Handle) scaleWorkers(desired int) { |
no test coverage detected