Committing Kea app to the database may hang
When I was testing #483 (closed), I came across an issue described in the following comment: !267 (comment 195348).
In order to reproduce, follow these steps:
- Start Stork server,
- Make sure that no Kea app runs on the machine with an agent,
- Launch agent registration procedure,
- Approve agent registration in the UI,
- Start Kea app on the monitored machine and allow some time for the agent to discover the Kea app,
- Navigate to the machine page and click "Get Latest State"
The request to get state should hang (not return status 200) and the app should be neither visible in the UI nor in the database. The database transaction committing the app to the database should hang.
As I explained in the following comment: !267 (comment 195373), the issue appears to be related to committing events to the database outside of an open transaction. We may consider committing the events within the transaction, but we should investigate why exactly it hangs to avoid this issue in the future.