فهرست منبع

profiling: default is now 'none' and config option will be checked instantly

Peter Bieringer 2 ماه پیش
والد
کامیت
15ebb1e647
3فایلهای تغییر یافته به همراه14 افزوده شده و 8 حذف شده
  1. 2 1
      DOCUMENTATION.md
  2. 2 2
      config
  3. 10 5
      radicale/config.py

+ 2 - 1
DOCUMENTATION.md

@@ -1696,9 +1696,10 @@ _(>= 3.5.10)_
 
 Log profiling data on level=info
 
-Default: `per_request`
+Default: `none`
 
 One of
+* `none` (disabled)
 * `per_request` (above minimum duration)
 * `per_request_method` (regular interval)
 

+ 2 - 2
config

@@ -322,8 +322,8 @@
 #storage_cache_actions_on_debug = False
 
 # Log profiling data on level=info
-# Value: per_request | per_request_method
-#profiling = per_request_method
+# Value: per_request | per_request_method | none
+#profiling = none
 
 # Log profiling data per request minium duration (seconds)
 #profiling_per_request_min_duration = 3

+ 10 - 5
radicale/config.py

@@ -41,12 +41,12 @@ from radicale import auth, hook, rights, storage, types, web
 from radicale.hook import email
 from radicale.item import check_and_sanitize_props
 
-from radicale import app # isort:skip (circular import issue)
-
 DEFAULT_CONFIG_PATH: str = os.pathsep.join([
     "?/etc/radicale/config",
     "?~/.config/radicale/config"])
 
+PROFILING: Sequence[str] = ("per_request", "per_request_method", "none")
+
 
 def positive_int(value: Any) -> int:
     value = int(value)
@@ -72,6 +72,12 @@ def logging_level(value: Any) -> str:
     return value
 
 
+def profiling(value: Any) -> str:
+    if value not in PROFILING:
+        raise ValueError("unsupported profiling: %r" % value)
+    return value
+
+
 def filepath(value: Any) -> str:
     if not value:
         return ""
@@ -584,10 +590,9 @@ This is an automated message. Please do not reply.""",
             "help": "log storage cache action on level=debug",
             "type": bool}),
         ("profiling", {
-            "value": "per_request_method",
+            "value": "none",
             "help": "log profiling data level=info",
-            "type": str,
-            "internal": app.PROFILING}),
+            "type": profiling}),
         ("profiling_per_request_min_duration", {
             "value": "3",
             "help": "log profiling data per request minimum duration (seconds)",