MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Ready

Method Ready

phxqueue/producer/batchhelper.cpp:132–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132bool BatchTask::Ready(uint64_t *ready_timestamp_ms) {
133 if (ready_timestamp_ms) *ready_timestamp_ms = 0;
134
135 if (0 == nitems_ || 0 == start_timestamp_ms_) return false;
136
137 auto now_timestamp_ms = comm::utils::Time::GetSteadyClockMS();
138
139 if (nbyte_ * 2 >= items_byte_size_limit_ ||
140 nitems_ * 2 >= batch_limit_ ||
141 start_timestamp_ms_ + producer_batch_delay_time_ms_ <= now_timestamp_ms) {
142 return true;
143 }
144 if (ready_timestamp_ms) *ready_timestamp_ms = start_timestamp_ms_ + producer_batch_delay_time_ms_;
145
146 return false;
147}
148
149comm::RetCode BatchTask::Process(bool is_timeout) {
150 auto now_timestamp_ms = comm::utils::Time::GetSteadyClockMS();

Callers 2

DispatchBatchTaskMethod · 0.80
BatchRawAddMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected