getOldestUnshippedBlockTime returns the unix timestamp with milliseconds precision of the oldest TSDB block not shipped to the storage yet, or 0 if all blocks have been shipped.
()
| 640 | // getOldestUnshippedBlockTime returns the unix timestamp with milliseconds precision of the oldest |
| 641 | // TSDB block not shipped to the storage yet, or 0 if all blocks have been shipped. |
| 642 | func (u *userTSDB) getOldestUnshippedBlockTime() uint64 { |
| 643 | shippedBlocks := u.getCachedShippedBlocks() |
| 644 | oldestTs := uint64(0) |
| 645 | |
| 646 | for _, b := range u.Blocks() { |
| 647 | if _, ok := shippedBlocks[b.Meta().ULID]; ok { |
| 648 | continue |
| 649 | } |
| 650 | |
| 651 | if oldestTs == 0 || b.Meta().ULID.Time() < oldestTs { |
| 652 | oldestTs = b.Meta().ULID.Time() |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | return oldestTs |
| 657 | } |
| 658 | |
| 659 | func (u *userTSDB) isIdle(now time.Time, idle time.Duration) bool { |
| 660 | lu := u.lastUpdate.Load() |
no test coverage detected