mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +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() {
|
go func() {
|
||||||
s.broker.SendMessage(ctx, &events.ScanStatus{Scanning: true, Count: 0, FolderCount: 0})
|
s.broker.SendMessage(ctx, &events.ScanStatus{Scanning: true, Count: 0, FolderCount: 0})
|
||||||
defer func() {
|
defer func() {
|
||||||
s.broker.SendMessage(ctx, &events.ScanStatus{
|
if status, ok := s.getStatus(mediaFolder); ok {
|
||||||
Scanning: false,
|
s.broker.SendMessage(ctx, &events.ScanStatus{
|
||||||
Count: int64(s.status[mediaFolder].fileCount),
|
Scanning: false,
|
||||||
FolderCount: int64(s.status[mediaFolder].folderCount),
|
Count: int64(status.fileCount),
|
||||||
})
|
FolderCount: int64(status.folderCount),
|
||||||
|
})
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue