Skip to content

Commit d509275

Browse files
committed
feat(core): hot reload path configs when exact name match is found
When a new path configuration is added via the API with a name that exactly matches an existing stream path, Mediamtx will now automatically hot reload the path with the new configuration without requiring disconnection and reconnection of publishers. See bluenviron#3718
1 parent bcebc4d commit d509275

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

internal/core/path_manager.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,16 @@ func (pm *pathManager) doReloadConf(newPaths map[string]*conf.Path) {
218218
continue
219219
}
220220

221-
// path now belongs to a different config: delete it
221+
// Check if we should switch to a new configuration
222+
// This happens when a new configuration is added with a name that exactly matches this path
223+
if newConf, exists := newPaths[pathName]; exists && newConf.Name == pathName {
224+
// Hot reload the path with the new configuration
225+
go path.reloadConf(newConf)
226+
continue
227+
}
228+
229+
// path now belongs to a different config but we can't switch to it (less specific): keep current config
222230
if pathConf.Name != path.conf.Name {
223-
pm.removePath(path)
224-
path.close()
225-
path.wait() // avoid conflicts between sources
226231
continue
227232
}
228233

0 commit comments

Comments
 (0)