Fix #1
All checks were successful
Build and push Docker image at git tag / build (push) Successful in 55s
All checks were successful
Build and push Docker image at git tag / build (push) Successful in 55s
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
# source code released under the terms of GNU Public License Version 3
|
||||
# https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
import random, os, json
|
||||
import random, os, json, time
|
||||
|
||||
from abc import abstractmethod, ABC
|
||||
from enum import Enum
|
||||
@ -64,6 +64,10 @@ class BasicAgent(ABC):
|
||||
pass
|
||||
|
||||
def _respond(self):
|
||||
# do a very short sleep
|
||||
time.sleep(random.random())
|
||||
|
||||
# sending
|
||||
send_it = lambda: self._send_message(self._response)
|
||||
if self.before_response(self._response, send_it) and self._do_response:
|
||||
send_it()
|
||||
|
@ -60,6 +60,6 @@ class WebMain():
|
||||
def message(request: Request, message:AgentMessage, background_tasks: BackgroundTasks) -> AgentResponse:
|
||||
return self.msg_process.new_message(message, background_tasks)
|
||||
|
||||
if __name__ == "ums.agent.main" and os.environ.get('SERVE', 'false') == 'true':
|
||||
if __name__ == "ums.agent.main" and os.environ.get('SERVE', 'false').lower() == 'true':
|
||||
main = WebMain()
|
||||
app = main.app
|
Reference in New Issue
Block a user