mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Fix streaming scenes not able to be deleted (#2549)
* Don't navigate away from scene if delete failed * Close connection on cancel
This commit is contained in:
@@ -7,6 +7,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Cancellable interface {
|
||||
Cancel()
|
||||
}
|
||||
|
||||
type LockContext struct {
|
||||
context.Context
|
||||
cancel context.CancelFunc
|
||||
@@ -57,6 +61,16 @@ func NewReadLockManager() *ReadLockManager {
|
||||
func (m *ReadLockManager) ReadLock(ctx context.Context, fn string) *LockContext {
|
||||
retCtx, cancel := context.WithCancel(ctx)
|
||||
|
||||
// if Cancellable, call Cancel() when cancelled
|
||||
cancellable, ok := ctx.(Cancellable)
|
||||
if ok {
|
||||
origCancel := cancel
|
||||
cancel = func() {
|
||||
origCancel()
|
||||
cancellable.Cancel()
|
||||
}
|
||||
}
|
||||
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user