Skip to content

Commit

Permalink
core: services: helper: Cache detect_service output
Browse files Browse the repository at this point in the history
- There is no reason to not do such thing.
- There is no way for us to check where is the swagger website without probing the valid paths.

Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Aug 10, 2022
1 parent dcfe8d1 commit 4c2ab9d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/services/helper/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import http
from functools import cache
from pathlib import Path
from typing import Any, List, Optional

Expand Down Expand Up @@ -45,7 +46,7 @@ class Helper:
LOCALSERVER_CANDIDATES = ["0.0.0.0", "::"]

@staticmethod
@temporary_cache(timeout_seconds=60)
@cache
def detect_service(port: int) -> ServiceInfo:
info = ServiceInfo(valid=False, title="Unknown", documentation_url="", versions=[], port=port)

Expand Down

0 comments on commit 4c2ab9d

Please sign in to comment.