Compare commits

..

No commits in common. "629556b5fcd673ee1e7ee1ffe780ff376bcedd15" and "bea9dd1590069f8b3d81eddbb16e5146aec0fd13" have entirely different histories.

3 changed files with 2 additions and 22 deletions

View File

@ -65,9 +65,6 @@ class Application(DiscordBotApplicationABC):
self._is_stopping = True
try:
self._logger.info(__name__, f"Try to stop {DiscordBotService.__name__}")
if self._feature_flags.get_flag(FeatureFlagsEnum.api_module):
self._api.stop()
await self._bot.close()
self._logger.info(__name__, f"Stopped {DiscordBotService.__name__}")
except Exception as e:

View File

@ -1,9 +1,8 @@
import socket
import sys
import textwrap
import uuid
from functools import partial
from typing import Union, Optional
from typing import Union
import eventlet
from cpl_core.dependency_injection import ServiceProviderABC
@ -61,8 +60,6 @@ class Api(Flask):
self._socketio.on_event("connect", self.on_connect)
self._socketio.on_event("disconnect", self.on_disconnect)
self._socket: Optional[socket] = None
self._requests = {}
@staticmethod
@ -155,14 +152,7 @@ class Api(Flask):
# from waitress import serve
# https://docs.pylonsproject.org/projects/waitress/en/stable/arguments.html
# serve(self, host=self._apt_settings.host, port=self._apt_settings.port, threads=10, connection_limit=1000, channel_timeout=10)
self._socket = eventlet.listen((self._api_settings.host, self._api_settings.port))
wsgi.server(self._socket, self, log_output=False)
def stop(self):
if self._socket is None:
return
self._socket.shutdown(socket.SHUT_RDWR)
self._socket.close()
wsgi.server(eventlet.listen((self._api_settings.host, self._api_settings.port)), self, log_output=False)
def on_connect(self):
self._logger.info(__name__, f"Client connected")

View File

@ -17,10 +17,3 @@ class ApiThread(threading.Thread):
self._api.start()
except Exception as e:
self._logger.error(__name__, "Start failed", e)
def stop(self):
try:
self._logger.trace(__name__, f"Try to stop {type(self._api).__name__}")
self._api.stop()
except Exception as e:
self._logger.error(__name__, "Stop failed", e)