ansibleguy76 / ansibleforms

A webapplication to create pretty advanced forms to run ansible playbooks or awx templates.
https://ansibleforms.com/
GNU General Public License v3.0
66 stars 10 forks source link

Skip schema check #189

Closed mdaugs closed 2 months ago

mdaugs commented 3 months ago

The schema check is done on each request.
This includes calling the patch_all method. Some indices are recreated and column types are modified.

This should only be done if necessary.

This PR introduces the most simple fix by just skipping the check for all requests except the schema endpoints.

ansibleguy76 commented 3 months ago

my plan was to move the schema check to the init code. this is run at startup. the schema is also cached. for the moment. i believe we can find a smarter solution.

ansibleguy76 commented 2 months ago

I will commit my changes. it will not implement the skipping of the schema check. As explained, the schema check result is cached for a day and ran on startup, so the call is indeed there, but the impact is very minimum due to the cached result.

mdaugs commented 2 months ago

I have moved the schema check to the init code. The schema will be checked on startup, in the backend.

  • If the database is down, the startup code will wait for the database to come up, that also tackles the fact that sometimes database queries start before the database is up.
  • if the database is up, the full check is done, including all the patching.
  • If the schema is absent, it will be logged, but the backend will start. As the /#/schema frontend api, can allow the creation.

The whole check is cached with "nodecache", which is caching for half a day. The schema check is not really a heavy load.

This sounds like a good solution. Thank you!