summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-07-26 18:40:56 +0100
committerDavid Robertson <davidr@element.io>2022-07-26 18:40:56 +0100
commit41228675b6f5c06c3b6a9ea8af03c8fc0fdea4ed (patch)
tree2f34c7248b8bfd8b78fbe8bc6e19b6a9463f30e2
parentRemove debug_specific_room (diff)
downloadsynapse-41228675b6f5c06c3b6a9ea8af03c8fc0fdea4ed.tar.xz
Tidy parser
-rwxr-xr-xsynapse/_scripts/debug_state_res.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/synapse/_scripts/debug_state_res.py b/synapse/_scripts/debug_state_res.py
index beed653b4c..a934ef5369 100755
--- a/synapse/_scripts/debug_state_res.py
+++ b/synapse/_scripts/debug_state_res.py
@@ -155,7 +155,7 @@ async def dump_mainlines(
 
 
 parser = argparse.ArgumentParser(
-    description="Explain the calculation which resolves state prior before an event"
+    description="Debug the stateres calculation of a specific event."
 )
 parser.add_argument(
     "config_file", help="Synapse config file", type=argparse.FileType("r")
@@ -164,8 +164,14 @@ parser.add_argument("--verbose", "-v", help="Log verbosely", action="store_true"
 parser.add_argument(
     "--debug", "-d", help="Enter debugger after state is resolved", action="store_true"
 )
-subparsers = parser.add_subparsers()
-
+parser.add_argument("event_id", help="The event ID to be resolved")
+parser.add_argument(
+    "--watch",
+    help="Track a piece of state in the auth DAG",
+    default=None,
+    nargs=2,
+    metavar=("TYPE", "STATE_KEY"),
+)
 
 async def debug_specific_stateres(
     reactor: ISynapseReactor, hs: MockHomeserver, args: argparse.Namespace
@@ -232,21 +238,6 @@ async def debug_specific_stateres(
         breakpoint()
 
 
-debug_parser = subparsers.add_parser(
-    "debug",
-    description="debug the stateres calculation of a specific event",
-)
-debug_parser.add_argument("event_id", help="the event ID to be resolved")
-debug_parser.add_argument(
-    "--watch",
-    help="track a piece of state in the auth DAG",
-    default=None,
-    nargs=2,
-    metavar=("TYPE", "STATE_KEY"),
-)
-debug_parser.set_defaults(func=debug_specific_stateres)
-
-
 if __name__ == "__main__":
     args = parser.parse_args()
     logging.basicConfig(
@@ -264,4 +255,4 @@ if __name__ == "__main__":
     ), patch("synapse.storage.databases.main.events_worker.MultiWriterIdGenerator"):
         hs.setup()
 
-    task.react(args.func, [hs, parser.parse_args()])
+    task.react(debug_specific_stateres, [hs, parser.parse_args()])