mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Fix data race in scanner
This commit is contained in:
parent
bbb9461000
commit
61dd8d55ca
1 changed files with 7 additions and 5 deletions
|
@ -111,11 +111,13 @@ func (s *scanner) startProgressTracker(mediaFolder string) (chan uint32, context
|
|||
go func() {
|
||||
s.broker.SendMessage(ctx, &events.ScanStatus{Scanning: true, Count: 0, FolderCount: 0})
|
||||
defer func() {
|
||||
s.broker.SendMessage(ctx, &events.ScanStatus{
|
||||
Scanning: false,
|
||||
Count: int64(s.status[mediaFolder].fileCount),
|
||||
FolderCount: int64(s.status[mediaFolder].folderCount),
|
||||
})
|
||||
if status, ok := s.getStatus(mediaFolder); ok {
|
||||
s.broker.SendMessage(ctx, &events.ScanStatus{
|
||||
Scanning: false,
|
||||
Count: int64(status.fileCount),
|
||||
FolderCount: int64(status.folderCount),
|
||||
})
|
||||
}
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue