(force bool)
| 363 | } |
| 364 | |
| 365 | func (this *BlocksFile) sync(force bool) error { |
| 366 | if !force { |
| 367 | if this.writtenBytes < this.opt.BytesPerSync { |
| 368 | return nil |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | if this.writtenBytes > 0 { |
| 373 | AckWriteThread() |
| 374 | err := this.fp.Sync() |
| 375 | ReleaseWriteThread() |
| 376 | if err != nil { |
| 377 | return err |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | this.writtenBytes = 0 |
| 382 | |
| 383 | this.syncAt = time.Now() |
| 384 | |
| 385 | if force { |
| 386 | return this.mFile.SyncUnsafe() |
| 387 | } |
| 388 | |
| 389 | return nil |
| 390 | } |
| 391 | |
| 392 | func (this *BlocksFile) closeReaderPool() { |
| 393 | for { |
no test coverage detected