MCPcopy Create free account
hub / github.com/apache/trafficserver / state_running

Method state_running

src/proxy/http/PreWarmManager.cc:702–749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702int
703PreWarmQueue::state_running(int event, void * /* data ATS_UNUSED */)
704{
705 switch (event) {
706 case EVENT_INTERVAL: {
707 for (auto &[dst, info] : _map) {
708 // mentain queues
709 _delete_closed_sm(info.init_list);
710 _delete_closed_sm(info.open_list);
711
712 // pre-warm new connections
713 _prewarm_on_event_interval(dst, info);
714
715 // set prewarmManager.stats
716 Dbg(dbg_ctl_v_prewarm_q, "dst=%.*s:%d type=%d alpn=%d miss=%d hit=%d init=%d open=%d", (int)dst->host.size(),
717 dst->host.data(), dst->port, (int)dst->type, dst->alpn_index, info.stat.miss, info.stat.hit, (int)info.init_list->size(),
718 (int)info.open_list->size());
719
720 auto &[counters, gauges] = *info.stats_ids;
721
722 ts::Metrics::Gauge::store(gauges[static_cast<int>(PreWarm::GaugeStat::INIT_LIST_SIZE)], info.init_list->size());
723 ts::Metrics::Gauge::store(gauges[static_cast<int>(PreWarm::GaugeStat::OPEN_LIST_SIZE)], info.open_list->size());
724 ts::Metrics::Counter::increment(counters[static_cast<int>(PreWarm::CounterStat::HIT)], info.stat.hit);
725 ts::Metrics::Counter::increment(counters[static_cast<int>(PreWarm::CounterStat::MISS)], info.stat.miss);
726
727 // clear PreWarmQueue::Stat
728 info.stat.miss = 0;
729 info.stat.hit = 0;
730 }
731 break;
732 }
733 case EVENT_IMMEDIATE: {
734 _reconfigure();
735
736 // reschedule tick event
737 EThread *ethread = this_ethread();
738 _tick_event->cancel();
739 _tick_event = ethread->schedule_every_local(this, _event_period);
740
741 break;
742 }
743 default:
744 ink_abort("unsupported event=%s (%d)", get_vc_event_name(event), event);
745 break;
746 }
747
748 return EVENT_DONE;
749}
750
751void
752PreWarmQueue::push(const PreWarm::SPtrConstDst &dst, PreWarmSM *sm)

Callers

nothing calls this directly

Calls 8

incrementFunction · 0.85
this_ethreadFunction · 0.85
get_vc_event_nameFunction · 0.85
schedule_every_localMethod · 0.80
ink_abortFunction · 0.50
sizeMethod · 0.45
dataMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected