Refresh package managers after setup (#4397)

* Refresh package managers after setup
* Fix default plugins/scrapers paths
This commit is contained in:
DingDongSoLong4
2023-12-27 01:57:10 +02:00
committed by GitHub
parent 9bd36408ee
commit 6ee7e6112b
3 changed files with 36 additions and 30 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"net/http"
"os"
"path/filepath"
"strings"
@@ -21,7 +20,6 @@ import (
"github.com/stashapp/stash/pkg/job"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models/paths"
"github.com/stashapp/stash/pkg/pkg"
"github.com/stashapp/stash/pkg/plugin"
"github.com/stashapp/stash/pkg/scene"
"github.com/stashapp/stash/pkg/scraper"
@@ -102,9 +100,6 @@ func Initialize(cfg *config.Config, l *log.Logger) (*Manager, error) {
scanSubs: &subscriptionManager{},
}
mgr.RefreshPluginSourceManager()
mgr.RefreshScraperSourceManager()
if !cfg.IsNewSystem() {
logger.Infof("using config file: %s", cfg.GetConfigFile())
@@ -135,25 +130,6 @@ func Initialize(cfg *config.Config, l *log.Logger) (*Manager, error) {
return mgr, nil
}
func initialisePackageManager(localPath string, srcPathGetter pkg.SourcePathGetter) *pkg.Manager {
const timeout = 10 * time.Second
httpClient := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
},
Timeout: timeout,
}
return &pkg.Manager{
Local: &pkg.Store{
BaseDir: localPath,
ManifestFile: pkg.ManifestFile,
},
PackagePathGetter: srcPathGetter,
Client: httpClient,
}
}
func formatDuration(t time.Duration) string {
switch {
case t >= time.Minute: // 1m23s or 2h45m12s
@@ -208,7 +184,11 @@ func (s *Manager) postInit(ctx context.Context) error {
s.PluginCache.RegisterSessionStore(s.SessionStore)
s.RefreshPluginCache()
s.RefreshPluginSourceManager()
s.RefreshScraperCache()
s.RefreshScraperSourceManager()
s.RefreshStreamManager()
s.RefreshDLNA()