(bPath string)
| 416 | } |
| 417 | |
| 418 | func (this *FS) waitBFile(bPath string) error { |
| 419 | this.mu.RLock() |
| 420 | _, isClosing := this.closingBMap[bPath] |
| 421 | this.mu.RUnlock() |
| 422 | if !isClosing { |
| 423 | return nil |
| 424 | } |
| 425 | |
| 426 | var maxWaits = 30_000 |
| 427 | for { |
| 428 | this.mu.RLock() |
| 429 | _, isClosing = this.closingBMap[bPath] |
| 430 | this.mu.RUnlock() |
| 431 | if !isClosing { |
| 432 | break |
| 433 | } |
| 434 | time.Sleep(1 * time.Millisecond) |
| 435 | maxWaits-- |
| 436 | |
| 437 | if maxWaits < 0 { |
| 438 | return errors.New("open blocks file timeout") |
| 439 | } |
| 440 | } |
| 441 | return nil |
| 442 | } |
no test coverage detected