Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iocore/eventsystem/P_UnixEThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "I_EThread.h"
#include "I_EventProcessor.h"

const int DELAY_FOR_RETRY = HRTIME_MSECONDS(10);
const ink_hrtime DELAY_FOR_RETRY = HRTIME_MSECONDS(10);

TS_INLINE Event *
EThread::schedule_imm(Continuation *cont, int callback_event, void *cookie)
Expand Down
8 changes: 7 additions & 1 deletion iocore/eventsystem/UnixEThread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,13 @@ EThread::execute_regular()
next_time = EventQueue.earliest_timeout();
ink_hrtime sleep_time = next_time - Thread::get_hrtime_updated();
if (sleep_time > 0) {
sleep_time = std::min(sleep_time, HRTIME_MSECONDS(thread_max_heartbeat_mseconds));
if (EventQueueExternal.localQueue.empty()) {
sleep_time = std::min(sleep_time, HRTIME_MSECONDS(thread_max_heartbeat_mseconds));
} else {
// Because of a missed lock, Timed-Event and Negative-Event have been pushed into localQueue for retry in awhile.
// Therefore, we have to set the limitation of sleep time in order to handle the next retry in time.
sleep_time = std::min(sleep_time, DELAY_FOR_RETRY);
}
++(current_metric->_wait);
} else {
sleep_time = 0;
Expand Down