mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-23 00:08:15 -07:00
Simpler, more efficient way of deleting inactive torrents
This commit is contained in:
@@ -91,6 +91,10 @@ func (t *Tracker) ServeAnnounce(w http.ResponseWriter, r *http.Request, p httpro
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
} else if torrent.PeerCount() == 0 {
|
||||
// Rather than deleting the torrent explicitly, let the tracker driver
|
||||
// ensure there are no race conditions.
|
||||
conn.PurgeInactiveTorrent(torrent.Infohash)
|
||||
}
|
||||
|
||||
resp := newAnnounceResponse(ann, user, torrent)
|
||||
|
||||
@@ -31,11 +31,6 @@ func NewTracker(cfg *config.Config) (*Tracker, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = tracker.StartPurgingRoutines(tp, &cfg.Tracker)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
bc, err := backend.Open(&cfg.Backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user