| 48 | } |
| 49 | |
| 50 | void GcsThrottle::UpdateState() { |
| 51 | // TODO(b/72643279): Switch to a monotonic clock. |
| 52 | int64 now = env_time_->NowSeconds(); |
| 53 | uint64 delta_secs = |
| 54 | std::max(int64{0}, now - static_cast<int64>(last_updated_secs_)); |
| 55 | available_tokens_ += delta_secs * config_.token_rate; |
| 56 | available_tokens_ = std::min(available_tokens_, config_.bucket_size); |
| 57 | last_updated_secs_ = now; |
| 58 | } |
| 59 | |
| 60 | } // namespace tensorflow |
nothing calls this directly
no test coverage detected