File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 3333#include "I_EThread.h"
3434#include "I_EventProcessor.h"
3535
36- const int DELAY_FOR_RETRY = HRTIME_MSECONDS (10 );
36+ const ink_hrtime DELAY_FOR_RETRY = HRTIME_MSECONDS (10 );
3737
3838TS_INLINE Event *
3939EThread ::schedule_imm (Continuation * cont , int callback_event , void * cookie )
Original file line number Diff line number Diff line change @@ -254,7 +254,13 @@ EThread::execute_regular()
254254 next_time = EventQueue.earliest_timeout ();
255255 ink_hrtime sleep_time = next_time - Thread::get_hrtime_updated ();
256256 if (sleep_time > 0 ) {
257- sleep_time = std::min (sleep_time, HRTIME_MSECONDS (thread_max_heartbeat_mseconds));
257+ if (EventQueueExternal.localQueue .empty ()) {
258+ sleep_time = std::min (sleep_time, HRTIME_MSECONDS (thread_max_heartbeat_mseconds));
259+ } else {
260+ // Because of a missed lock, Timed-Event and Negative-Event have been pushed into localQueue for retry in awhile.
261+ // Therefore, we have to set the limitation of sleep time in order to handle the next retry in time.
262+ sleep_time = std::min (sleep_time, DELAY_FOR_RETRY);
263+ }
258264 ++(current_metric->_wait );
259265 } else {
260266 sleep_time = 0 ;
You can’t perform that action at this time.
0 commit comments