mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-12 12:08:36 -07:00
Only prune torrents if they have no peers
This commit is contained in:
@@ -78,7 +78,15 @@ func TestTorrentPurging(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if status != http.StatusOK {
|
||||
t.Fatalf("expected torrent to exist (got %s)", http.StatusText(status))
|
||||
}
|
||||
|
||||
time.Sleep(1010 * time.Millisecond)
|
||||
_, status, err = fetchPath(torrentApiPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if status != http.StatusOK {
|
||||
t.Fatalf("expected torrent to exist (got %s)", http.StatusText(status))
|
||||
}
|
||||
@@ -88,13 +96,12 @@ func TestTorrentPurging(t *testing.T) {
|
||||
peer["event"] = "stopped"
|
||||
announce(peer, srv)
|
||||
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
time.Sleep(1010 * time.Millisecond)
|
||||
|
||||
_, status, err = fetchPath(torrentApiPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if status != http.StatusNotFound {
|
||||
t.Fatalf("expected torrent to have been purged (got %s)", http.StatusText(status))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user