| 700 | } |
| 701 | |
| 702 | int |
| 703 | PreWarmQueue::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 | |
| 751 | void |
| 752 | PreWarmQueue::push(const PreWarm::SPtrConstDst &dst, PreWarmSM *sm) |
nothing calls this directly
no test coverage detected