Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions app/services/stamp_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,14 +602,20 @@ async def _wait_for_stamp_usable(self, batch_id: str, timeout: int = 90) -> bool
return False

async def _get_stamp_ttl(self, batch_id: str) -> Optional[int]:
"""Get current TTL for a stamp."""
"""Get current TTL for a stamp via direct Bee API lookup."""
try:
stamps = await swarm_api.get_all_stamps_processed()
stamp = next((s for s in stamps if s.get("batchID") == batch_id), None)
if stamp:
return stamp.get("batchTTL", 0)
from app.services.http_client import get_client
from urllib.parse import urljoin
api_url = urljoin(str(settings.SWARM_BEE_API_URL), f"stamps/{batch_id}")
client = get_client()
response = await client.get(api_url, timeout=10)
if response.status_code == 200:
data = response.json()
return data.get("batchTTL", 0)
else:
logger.warning(f"Stamp TTL lookup failed for {batch_id[:16]}...: HTTP {response.status_code}")
except Exception as e:
logger.warning(f"Error getting stamp TTL: {e}")
logger.warning(f"Error getting stamp TTL for {batch_id[:16]}...: {e}")
return None

async def _update_stamp_ttls(self):
Expand Down
Loading