OpenDataServices / org-ids

Front end application for http://org-id.guide
http://org-id.guide
Other
17 stars 9 forks source link

refresh_data should be called better #234

Open odscjames opened 3 years ago

odscjames commented 3 years ago

I think, currently this app has a function refresh_data - https://github.com/OpenDataServices/org-ids/blob/live/prefix_finder/frontend/views.py#L178

This gets the latest data from the source.

Therefore, it should be called regularly to make sure we get the latest data, and in a sensible way.

Currently it is called from a line in views.py - https://github.com/OpenDataServices/org-ids/blob/live/prefix_finder/frontend/views.py#L178

This means when a new server process for this app is created, it's called then. Actually no - when a new server process is created the first time it gets a request it loads the views file THEN gets the latest data (tested this in UWSGI logs).

Shouldn't this be run from a command, with a cron job updating regularly?

Note this function is also called by calls to URLS ^_preview_branch/([A-Za-z0-9-]+ - some way of allowing people to preview different branches should be provided - maybe remove the URL and add a parameter to the command?