Remove unneeded functions

This commit is contained in:
Ingo Oppermann
2025-07-21 15:37:26 +02:00
parent 96f1e81fed
commit f827ca9dd1
2 changed files with 5 additions and 29 deletions

View File

@@ -1167,7 +1167,6 @@ func (r *restream) UpdateProcess(id app.ProcessID, config *app.Config, force boo
if !ok {
return ErrUnknownProcess
}
defer r.tasks.Unlock(id)
err := r.updateProcess(task, config, force)
@@ -1305,11 +1304,10 @@ func (r *restream) DeleteProcess(id app.ProcessID) error {
if !ok {
return ErrUnknownProcess
}
defer r.tasks.Unlock(id)
err := r.deleteProcess(task)
r.tasks.Unlock(id)
if err != nil {
return err
}
@@ -1414,11 +1412,10 @@ func (r *restream) ReloadProcess(id app.ProcessID) error {
if !ok {
return ErrUnknownProcess
}
defer r.tasks.Unlock(id)
err := r.reloadProcess(task)
r.tasks.Unlock(id)
if err != nil {
return err
}
@@ -1607,11 +1604,10 @@ func (r *restream) ReloadSkills() error {
}
func (r *restream) GetPlayout(id app.ProcessID, inputid string) (string, error) {
task, ok := r.tasks.LoadAndRLock(id)
task, ok := r.tasks.LoadUnsafe(id)
if !ok {
return "", ErrUnknownProcess
}
defer r.tasks.RUnlock(id)
port, ok := task.playout[inputid]
if !ok {

View File

@@ -84,6 +84,8 @@ func (m *Storage) Has(id app.ProcessID) bool {
return hasTask
}
// LoadUnsafe returns the value stored in the map for a key, or zero value of type V if no value is present.
// The ok result indicates whether value was found in the map.
func (m *Storage) LoadUnsafe(id app.ProcessID) (*task, bool) {
mt, ok := m.tasks.Load(id)
if !ok {
@@ -93,28 +95,6 @@ func (m *Storage) LoadUnsafe(id app.ProcessID) (*task, bool) {
return mt.task, true
}
// LoadAndRLock returns the value stored in the map for a key, or zero value of type V if no value is present.
// The ok result indicates whether value was found in the map.
func (m *Storage) LoadAndRLock(id app.ProcessID) (*task, bool) {
mt, ok := m.tasks.Load(id)
if !ok {
return nil, false
}
mt.lock.RLock()
return mt.task, true
}
func (m *Storage) RUnlock(id app.ProcessID) {
mt, ok := m.tasks.Load(id)
if !ok {
return
}
mt.lock.RUnlock()
}
func (m *Storage) LoadAndLock(id app.ProcessID) (*task, bool) {
mt, ok := m.tasks.Load(id)
if !ok {