ソースを参照

Simplified handler logic
The direct handler is always a coroutine, no need to perform this additional check.

Stan Janssen 4 年 前
コミット
3a176543fc
1 ファイル変更1 行追加5 行削除
  1. 1 5
      pyopenadr/service/vtn_service.py

+ 1 - 5
pyopenadr/service/vtn_service.py

@@ -33,11 +33,7 @@ class VTNService:
 
         if message_type in self.handlers:
             handler = self.handlers[message_type]
-            result = handler(message_payload)
-            if iscoroutine(result):
-                response_type, response_payload = await result
-            else:
-                response_type, response_payload = result
+            response_type, response_payload = await handler(message_payload)
 
             # Get the relevant template and create the XML response
             template = self.templates.get_template(f'{response_type}.xml')