fix(plugins): add debug logs to syncPlugins for troubleshooting
Log skipped entries, total entries vs plugins found, and DB state to help diagnose why sync may not find new plugins. Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
39f8eec8d2
commit
97c01c0614
1 changed files with 3 additions and 0 deletions
|
|
@ -138,11 +138,13 @@ func (m *Manager) syncPlugins(ctx context.Context, folder string) error {
|
||||||
filesOnDisk := make(map[string]string) // name -> path
|
filesOnDisk := make(map[string]string) // name -> path
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if entry.IsDir() || !strings.HasSuffix(entry.Name(), PackageExtension) {
|
if entry.IsDir() || !strings.HasSuffix(entry.Name(), PackageExtension) {
|
||||||
|
log.Trace(ctx, "Skipping non-plugin entry", "name", entry.Name(), "isDir", entry.IsDir())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
name := strings.TrimSuffix(entry.Name(), PackageExtension)
|
name := strings.TrimSuffix(entry.Name(), PackageExtension)
|
||||||
filesOnDisk[name] = filepath.Join(folder, entry.Name())
|
filesOnDisk[name] = filepath.Join(folder, entry.Name())
|
||||||
}
|
}
|
||||||
|
log.Debug(ctx, "Plugin sync: scanned folder", "folder", folder, "entriesTotal", len(entries), "pluginsFound", len(filesOnDisk))
|
||||||
|
|
||||||
// Get all plugins from DB
|
// Get all plugins from DB
|
||||||
repo := m.ds.Plugin(adminCtx)
|
repo := m.ds.Plugin(adminCtx)
|
||||||
|
|
@ -154,6 +156,7 @@ func (m *Manager) syncPlugins(ctx context.Context, folder string) error {
|
||||||
for i := range dbPlugins {
|
for i := range dbPlugins {
|
||||||
pluginsInDB[dbPlugins[i].ID] = &dbPlugins[i]
|
pluginsInDB[dbPlugins[i].ID] = &dbPlugins[i]
|
||||||
}
|
}
|
||||||
|
log.Debug(ctx, "Plugin sync: current DB state", "pluginsInDB", len(pluginsInDB))
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue