debridmediamanager / zurg-testing

A self-hosted Real-Debrid webdav server you can use with Infuse. Together with rclone it can mount your Real-Debrid torrent library into your filesystem and load it to Plex or Jellyfin.
489 stars 38 forks source link

Error On Empty Real Debrid #16

Closed maxexcloo closed 9 months ago

maxexcloo commented 10 months ago

When running zurg on an empty Real Debrid account the following error/warning comes up, maybe it could be handled in a better way?

Logging to logs/zurg-2023-12-16.log
2023-12-16T02:22:43.158+1100    ERROR   realdebrid      Error when decoding get torrents JSON: EOF
2023-12-16T02:22:43.159+1100    WARN    manager Cannot get torrents: EOF

2023-12-16T02:22:43.453+1100    ERROR   realdebrid      Error when decoding get torrents JSON: EOF
2023-12-16T02:22:43.453+1100    WARN    manager Checksum API Error: EOF

2023-12-16T02:22:43.453+1100    INFO    manager Finished initializing torrent manager
2023-12-16T02:22:43.454+1100    INFO    manager Starting periodic refresh
2023-12-16T02:22:43.455+1100    ERROR   realdebrid      Error when decoding get torrents JSON: EOF
2023-12-16T02:22:43.454+1100    INFO    zurg    Starting server on [::]:9999
2023/12/16 02:22:43.455334 [ants]: worker exits from panic: send on closed channel
goroutine 8 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x64
github.com/panjf2000/ants/v2.(*goWorker).run.func1.1()
        github.com/panjf2000/ants/v2@v2.8.2/worker.go:56 +0xb0
panic({0x100d00be0?, 0x100d8f2c8?})
        runtime/panic.go:914 +0x218
github.com/debridmediamanager/zurg/internal/torrent.(*TorrentManager).getCurrentState.func1()
        github.com/debridmediamanager/zurg/internal/torrent/latestState.go:64 +0x54
github.com/panjf2000/ants/v2.(*goWorker).run.func1()
        github.com/panjf2000/ants/v2@v2.8.2/worker.go:67 +0x80
created by github.com/panjf2000/ants/v2.(*goWorker).run in goroutine 1
        github.com/panjf2000/ants/v2@v2.8.2/worker.go:48 +0x98

2023/12/16 02:22:43.458665 [ants]: worker exits from panic: send on closed channel
goroutine 10 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x64
github.com/panjf2000/ants/v2.(*goWorker).run.func1.1()
        github.com/panjf2000/ants/v2@v2.8.2/worker.go:56 +0xb0
panic({0x100d00be0?, 0x100d8f2c8?})
        runtime/panic.go:914 +0x218
github.com/debridmediamanager/zurg/internal/torrent.(*TorrentManager).getCurrentState.func3()
        github.com/debridmediamanager/zurg/internal/torrent/latestState.go:85 +0x68
github.com/panjf2000/ants/v2.(*goWorker).run.func1()
        github.com/panjf2000/ants/v2@v2.8.2/worker.go:67 +0x80
created by github.com/panjf2000/ants/v2.(*goWorker).run in goroutine 1
        github.com/panjf2000/ants/v2@v2.8.2/worker.go:48 +0x98
yowmamasita commented 10 months ago

I'll fix this in the next release. Thanks for reporting!

yowmamasita commented 9 months ago

https://github.com/debridmediamanager/zurg-testing/wiki/zurg-is-now-v0.9.3-old

maxexcloo commented 9 months ago

Thanks for the fix mate :)