@@ -72,8 +72,8 @@ class abstract_smooth_rate_limiter : public rate_limiter {
72
72
protected:
73
73
virtual void do_set_rate (double permits_per_second,
74
74
double stable_internal_micros) = 0;
75
- virtual long stored_permits_to_wait_time (double stored_permits,
76
- double permits_to_take) = 0;
75
+ virtual std::chrono::milliseconds stored_permits_to_wait_time (
76
+ double stored_permits, double permits_to_take) = 0;
77
77
virtual double cool_down_internal_micros () = 0;
78
78
void resync (std::chrono::steady_clock::time_point now_micros) {
79
79
// if next_free_ticket is in the past, resync to now
@@ -110,10 +110,11 @@ class abstract_smooth_rate_limiter : public rate_limiter {
110
110
double stored_permits_to_spend =
111
111
std::min ((double )required_permits, this ->stored_permits_ );
112
112
double fresh_permits = required_permits - stored_permits_to_spend;
113
- std::chrono::milliseconds wait_micros = std::chrono::milliseconds (
113
+ std::chrono::milliseconds wait_micros =
114
114
stored_permits_to_wait_time (this ->stored_permits_ ,
115
115
stored_permits_to_spend) +
116
- (long )(fresh_permits * this ->stable_internal_micros_ ));
116
+ std::chrono::milliseconds (
117
+ (long )(fresh_permits * this ->stable_internal_micros_ ));
117
118
this ->next_free_ticket_micros_ += wait_micros;
118
119
this ->stored_permits_ -= stored_permits_to_spend;
119
120
return return_value;
@@ -159,9 +160,9 @@ class smooth_bursty_rate_limiter : public abstract_smooth_rate_limiter {
159
160
<< " , stored_permits_:" << this ->stored_permits_ ;
160
161
}
161
162
162
- long stored_permits_to_wait_time (double stored_permits,
163
- double permits_to_take) {
164
- return 0L ;
163
+ std::chrono::milliseconds stored_permits_to_wait_time (
164
+ double stored_permits, double permits_to_take) {
165
+ return std::chrono::milliseconds ( 0 ) ;
165
166
}
166
167
167
168
double cool_down_internal_micros () { return this ->stable_internal_micros_ ; }
0 commit comments