Explorar o código

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

Stan Janssen %!s(int64=3) %!d(string=hai) anos
pai
achega
3a176543fc
Modificáronse 1 ficheiros con 1 adicións e 5 borrados
  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')