Skip to content

Commit c7174fe

Browse files
authored
fix: remove unused variable (#1150)
Signed-off-by: Frederico Araujo <[email protected]>
1 parent d32a87a commit c7174fe

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

plugins/circuit_breaker/circuit_breaker.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@
1212
Hooks: tool_pre_invoke, tool_post_invoke
1313
"""
1414

15+
# Future
1516
from __future__ import annotations
1617

17-
import time
18+
# Standard
1819
from collections import deque
1920
from dataclasses import dataclass
20-
from typing import Any, Deque, Dict, Optional
21+
import time
22+
from typing import Any, Deque, Dict
2123

24+
# Third-Party
2225
from pydantic import BaseModel
2326

27+
# First-Party
2428
from mcpgateway.plugins.framework import (
2529
Plugin,
2630
PluginConfig,
@@ -92,7 +96,6 @@ def __init__(self, config: PluginConfig) -> None:
9296
async def tool_pre_invoke(self, payload: ToolPreInvokePayload, context: PluginContext) -> ToolPreInvokeResult:
9397
tool = payload.name
9498
st = _get_state(tool)
95-
cfg = _cfg_for(self._cfg, tool)
9699
now = _now()
97100
# Close breaker if cooldown elapsed
98101
if st.open_until and now >= st.open_until:
@@ -147,10 +150,12 @@ async def tool_post_invoke(self, payload: ToolPostInvokePayload, context: Plugin
147150

148151
if should_open and not st.open_until:
149152
st.open_until = now + max(1, int(cfg.cooldown_seconds))
150-
return ToolPostInvokeResult(metadata={
151-
"circuit_calls_in_window": calls,
152-
"circuit_failures_in_window": len(st.failures),
153-
"circuit_failure_rate": round(failure_rate, 3),
154-
"circuit_consecutive_failures": st.consecutive_failures,
155-
"circuit_open_until": st.open_until or 0.0,
156-
})
153+
return ToolPostInvokeResult(
154+
metadata={
155+
"circuit_calls_in_window": calls,
156+
"circuit_failures_in_window": len(st.failures),
157+
"circuit_failure_rate": round(failure_rate, 3),
158+
"circuit_consecutive_failures": st.consecutive_failures,
159+
"circuit_open_until": st.open_until or 0.0,
160+
}
161+
)

0 commit comments

Comments
 (0)