Skip to content
Snippets Groups Projects
Commit a8920c21 authored by Aleš Mrázek's avatar Aleš Mrázek
Browse files

python: formatting improvements

parent 9cd37f98
No related branches found
No related tags found
1 merge request!1651manager: processes watchdog error during shutdown
......@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Literal, Optional, Tuple, Union
from knot_resolver.constants import API_SOCK_FILE, RUN_DIR, VERSION
from knot_resolver.datamodel.cache_schema import CacheSchema
from knot_resolver.datamodel.defer_schema import DeferSchema
from knot_resolver.datamodel.dns64_schema import Dns64Schema
from knot_resolver.datamodel.dnssec_schema import DnssecSchema
from knot_resolver.datamodel.forward_schema import ForwardSchema
......@@ -17,7 +18,6 @@ from knot_resolver.datamodel.monitoring_schema import MonitoringSchema
from knot_resolver.datamodel.network_schema import NetworkSchema
from knot_resolver.datamodel.options_schema import OptionsSchema
from knot_resolver.datamodel.rate_limiting_schema import RateLimitingSchema
from knot_resolver.datamodel.defer_schema import DeferSchema
from knot_resolver.datamodel.templates import POLICY_CONFIG_TEMPLATE, WORKER_CONFIG_TEMPLATE
from knot_resolver.datamodel.types import EscapedStr, IntPositive, WritableDir
from knot_resolver.datamodel.view_schema import ViewSchema
......
from knot_resolver.utils.modeling import ConfigSchema
from knot_resolver.datamodel.types import TimeUnit
from knot_resolver.utils.modeling import ConfigSchema
class DeferSchema(ConfigSchema):
......
......@@ -27,7 +27,7 @@ class RateLimitingSchema(ConfigSchema):
dry_run: bool = False
def _validate(self) -> None:
max_instant_limit = int(2 ** 32 // 768 - 1)
max_instant_limit = int(2**32 // 768 - 1)
if not int(self.instant_limit) <= max_instant_limit:
raise ValueError(f"'instant-limit' has to be in range 1..{max_instant_limit}")
if not int(self.rate_limit) <= 1000 * int(self.instant_limit):
......
from typing import List, Literal, Optional
from knot_resolver.datamodel.types import IDPattern, IPNetwork
from knot_resolver.datamodel.types import FloatNonNegative
from knot_resolver.datamodel.types import FloatNonNegative, IDPattern, IPNetwork
from knot_resolver.utils.modeling import ConfigSchema
......
......@@ -441,12 +441,12 @@ class KresManager: # pylint: disable=too-many-instance-attributes
raise
except BaseException:
invoke_callback = True
logger.error("Knot Resolver watchdog failed with an unexpected exception.", exc_info=True)
logger.error("Knot Resolver processes watchdog failed with an unexpected exception.", exc_info=True)
if invoke_callback:
try:
await self._instability_handler()
except Exception:
logger.error("Watchdog failed while invoking instability callback", exc_info=True)
logger.error("Processes watchdog failed while invoking instability callback", exc_info=True)
logger.error("Violently terminating!")
sys.exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment