mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
Fix race condition
We had some test flakiness involving the index.lock file which is fixed by this commit. We shouldn't be accessing newTaskID without the mutex, although I'm surprised that this actually fixes the issue. Surely we don't have tasks (which typically render to the main view) which use index.lock?
This commit is contained in:
parent
6282d55919
commit
bf7726d130
@ -324,10 +324,13 @@ func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error
|
||||
|
||||
self.waitingMutex.Lock()
|
||||
|
||||
self.taskIDMutex.Lock()
|
||||
if taskID < self.newTaskID {
|
||||
self.waitingMutex.Unlock()
|
||||
self.taskIDMutex.Unlock()
|
||||
return
|
||||
}
|
||||
self.taskIDMutex.Unlock()
|
||||
|
||||
if self.stopCurrentTask != nil {
|
||||
self.stopCurrentTask()
|
||||
|
Loading…
x
Reference in New Issue
Block a user