MCPcopy Create free account
hub / github.com/Tong89/smartNode / _effective_priority

Method _effective_priority

backend/core.py:839–846  ·  view source on GitHub ↗

有效优先级 = 基础优先级 + 老化加权(随等待时间单调上升,封顶 AGING_MAX)。 使长期得不到链路的低优先级请求随等待自动升权,避免饥饿。

(self, req)

Source from the content-addressed store, hash-verified

837 return size
838
839 def _effective_priority(self, req):
840 """有效优先级 = 基础优先级 + 老化加权(随等待时间单调上升,封顶 AGING_MAX)。
841
842 使长期得不到链路的低优先级请求随等待自动升权,避免饥饿。
843 """
844 base = req.priority or 0
845 wait = max(0.0, self.current_time - (req.submit_time if req.submit_time is not None else self.current_time))
846 return base + min(AGING_MAX, AGING_FACTOR * wait)
847
848 def _update_transmissions(self, delta_time):
849 """更新所有传输任务的进度 (包含动态链路切换逻辑)"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected