Closed deathbybandaid closed 2 years ago
Note: I have no experience with go, but I do have experience with other languages, so while I am confident in my ability to find and provide a solution I am not comfortable committing anything due to my lack of experience with the go language, however this issue hasn't been resolved and it feels like a simple solution.
targetCounter := 0
for {
if targetCounter == 4 {
// sleep indefinitely
select{}
} else {
counter += 1
time.Sleep(30 * time.Second)
continue
}
I would much prefer this (and the others) to be at least a minute maybe 3 as suggested by OP https://github.com/Cloudbox/autoscan/blob/5c66ab857f70e6d6d37166f12546969ef55e278f/cmd/autoscan/main.go#L364-L365
The main reason why Autoscan halts any scanning when a target is down is because we want to prevent two things:
@UnknownWitcher the indefinite sleep is not necessarily related to this issue. Autoscan will only reach that state when the target is throwing a fatal error, which can only occur if there are setup-related problems (and thus only an adjustment to the config can make a difference).
Autoscan's current behaviour is to check Target health every 15 seconds. By specifically checking for health (instead of simply sending other scans), no duplicate scans occur. If all targets are found to be healthy, scanning will continue!
Now, I hear you wonder:
Can't Autoscan simply keep track of which scans have been successfully processed by certain targets? So if a target is unavailable, only that target will receive scans at a later date?
We did think about this while designing Autoscan, but by linking scans to targets, the database becomes dependent on the config. We try to avoid this as much as possible as it can cause issues when someone's config changes.
Hey @m-rots thanks for getting back to me, that's completely understandable and yes I did have that thought lol, anyway, I ended up running the container with "depends_on - plex" to avoid this issue.
I run autoscan with systemd with the following targets: 2 plex, 1 jellyfin, 1 emby.
More often than I'd like, one of these will be down, sometimes resulting in a script exit.
If missing upon startup:
If missing after it's recieved a task to send to targets:
What I'd suggest is handling the error with:
Target {target_info} is unavailable, will try to initialize again in 3 minutes.
And
Target {target_info} is unavailable, will try to send task again in 3 minutes. (attempt 1 of 3)
This way, tasks can get sent to the Available targets, and not get hung up on a single downed target.