latenighttales / alcali

Featureful Saltstack GUI
https://alcali.dev
MIT License
356 stars 62 forks source link

Design change - pull data with a background worker. API endpoints should use a pre-filled table or view #434

Open ITJamie opened 2 years ago

ITJamie commented 2 years ago

Describe the feat you'd like API endpoints like minions can be quite slow to load if data in the db is large OR if some minions have not had a highstate run in a long time (thus having to reach far back into db history) I suggest making a table or view that contains all the latest computed data per minion.

Right now the viewset for minion is actually running a salt command (test.ping). I would suggest this moves into another function that gets called every x minutes by a queue worker / background task.

Some rough data. our salt db contains about 5 months of data. it is over 20gb.

In general it would be better that any of the "get" requests use pre-populated db data where possible. salt-call commands should only be run if making a change or triggering a "refresh" of the data being viewed.