Prevent stale torrents
This commit is contained in:
@@ -31,7 +31,6 @@ type RootResponse struct {
|
||||
Logs string `json:"logs"`
|
||||
UserInfo *realdebrid.User `json:"user_info"`
|
||||
APITraffic uint64 `json:"traffic_from_api"`
|
||||
RequestedMB uint64 `json:"requested_mb"`
|
||||
ServedMB uint64 `json:"served_mb"`
|
||||
LibrarySize int `json:"library_size"` // Number of torrents in the library
|
||||
TorrentsToRepair string `json:"repair_queue"` // List of torrents in the repair queue
|
||||
@@ -103,7 +102,6 @@ func (zr *Handlers) generateResponse(resp http.ResponseWriter, req *http.Request
|
||||
Logs: fmt.Sprintf("//%s/logs/", req.Host),
|
||||
UserInfo: userInfo,
|
||||
APITraffic: uint64(trafficFromAPI),
|
||||
RequestedMB: bToMb(zr.downloader.RequestedBytes.Load()),
|
||||
ServedMB: bToMb(zr.downloader.TotalBytes.Load()),
|
||||
LibrarySize: allTorrents.Count(),
|
||||
TorrentsToRepair: repairQueueStr,
|
||||
@@ -193,7 +191,7 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
response.Logs,
|
||||
)
|
||||
|
||||
denominator := response.RequestedMB
|
||||
denominator := bToMb(response.APITraffic - zr.trafficOnStartup.Load())
|
||||
if denominator == 0 {
|
||||
denominator = 1
|
||||
}
|
||||
@@ -234,17 +232,13 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
<td>Traffic Logged</td>
|
||||
<td colspan="2">%d MB (%d MB added)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Traffic Requested</td>
|
||||
<td colspan="2">%d MB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Traffic Served</td>
|
||||
<td colspan="2">%d MB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Traffic Efficiency</td>
|
||||
<td colspan="2">%d%% (wasted %d MB)</td>
|
||||
<td colspan="2">%d%% (wasted %d MB) disclaimer: this assumes all RD traffic comes from this zurg instance</td>
|
||||
</tr>`,
|
||||
response.LibrarySize,
|
||||
response.MemAlloc,
|
||||
@@ -254,10 +248,9 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
response.PID,
|
||||
bToMb(response.APITraffic),
|
||||
bToMb(response.APITraffic-zr.trafficOnStartup.Load()),
|
||||
response.RequestedMB,
|
||||
response.ServedMB,
|
||||
efficiency,
|
||||
response.RequestedMB-response.ServedMB,
|
||||
bToMb(response.APITraffic-zr.trafficOnStartup.Load())-response.ServedMB,
|
||||
)
|
||||
|
||||
out += fmt.Sprintf(`
|
||||
|
||||
Reference in New Issue
Block a user