MCPcopy
hub / github.com/AstrBotDevs/AstrBot / flush

Method flush

astrbot/core/utils/metrics.py:175–184  ·  view source on GitHub ↗

Flush pending metrics immediately.

()

Source from the content-addressed store, hash-verified

173
174 @staticmethod
175 async def flush() -> None:
176 """Flush pending metrics immediately."""
177 lock = Metric._get_lock()
178 async with lock:
179 pending_metrics = list(Metric._pending_metrics.values())
180 Metric._pending_metrics = {}
181
182 for metrics_data in pending_metrics:
183 await Metric._post_metrics(metrics_data)
184 await asyncio.sleep(0.25)
185
186 @staticmethod
187 async def _post_metrics(metrics_data: dict[str, Any]) -> None:

Callers 15

_add_pending_metricsMethod · 0.45
_flush_periodicallyMethod · 0.45
put_configFunction · 0.45
update_configFunction · 0.45
create_kbMethod · 0.45
insert_provider_statMethod · 0.45
create_webchat_threadMethod · 0.45
create_api_keyMethod · 0.45
insert_personaMethod · 0.45
insert_persona_folderMethod · 0.45
_opMethod · 0.45

Calls 4

_post_metricsMethod · 0.80
listFunction · 0.50
_get_lockMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected