jellyfin: retry initial connection (configurable)

retries initial connection to Jellyfin 6 times, with a 10s gap between,
before failing. SHould help with issues of jfa-go starting before
Jellyfin.
Configurable in Settings > Advanced > "Initial auth retry count/gap".
This commit is contained in:
Harvey Tindall
2023-10-03 09:33:56 +01:00
parent 4f78b7c33b
commit f6fdd41b35
4 changed files with 31 additions and 43 deletions
+6 -1
View File
@@ -391,7 +391,12 @@ func start(asDaemon, firstCall bool) {
app.jf.Verbose = true
}
var status int
_, status, err = app.jf.Authenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String())
retryOpts := mediabrowser.MustAuthenticateOptions{
RetryCount: app.config.Section("advanced").Key("auth_retry_count").MustInt(6),
RetryGap: time.Duration(app.config.Section("advanced").Key("auth_retry_gap").MustInt(10)) * time.Second,
LogFailures: true,
}
_, status, err = app.jf.MustAuthenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String(), retryOpts)
if status != 200 || err != nil {
app.err.Fatalf("Failed to authenticate with Jellyfin @ \"%s\" (%d): %v", server, status, err)
}