Are the System-Events executed async?

I added an Event-Hook into my plugin, so that I can listen on several system-events, like "Startup", "Connected", "PrintStarted", etc.

Now I was asking myself, if my plugin code execution takes a long time, is octoprint waiting till the end of the execution or "hangs" octoprint.

   def on_event(self, event, payload):
        ...
		## do long execution. e.g. load huge data from external webservice via a "300baud modem"
        ...

Events are processed in the event bus's thread. So when you take a long time you'll block the event bus but you won't block the whole system.

In general it might be a good idea to load off huge tasks into your own thread instead of blocking the event bus though, depending on how big of a task we are talking. Downloading huge chunks of data would certainly qualify in my eyes.

Thx, a lot for your answer!
I will implement some kind of ExecutionThreadQueue in my Plugin.

BR
Olli