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 @@ -264,7 +264,13 @@ EThread::execute_regular()
264264 next_time = EventQueue.earliest_timeout ();
265265 ink_hrtime sleep_time = next_time - Thread::get_hrtime_updated ();
266266 if (sleep_time > 0 ) {
267- sleep_time = std::min (sleep_time, HRTIME_MSECONDS (thread_max_heartbeat_mseconds));
267+ if (EventQueueExternal.localQueue .empty ()) {
268+ sleep_time = std::min (sleep_time, HRTIME_MSECONDS (thread_max_heartbeat_mseconds));
269+ } else {
270+ // Because of a missed lock, Timed-Event and Negative-Event have been pushed into localQueue for retry in awhile.
271+ // Therefore, we have to set the limitation of sleep time in order to handle the next retry in time.
272+ sleep_time = std::min (sleep_time, DELAY_FOR_RETRY);
273+ }
268274 ++(current_metric->_wait );
269275 } else {
270276 sleep_time = 0 ;
You can’t perform that action at this time.
0 commit comments