messa / pyladies-courseware

Homework/task submit and review web app · based on React and Python aiohttp
https://projekty.pyladies.cz/
MIT License
18 stars 26 forks source link

Periodically refetch material (naucse) data #165

Open messa opened 4 years ago

messa commented 4 years ago

Currently course structure and lesson contents (list of materials...) are retrieved from course API (i.e. naucse API) only when the backend service is starting. So users don't see any changes to the API data source made after that.

(Pyvec Slack: https://pyvec.slack.com/archives/C7FAR7HBL/p1573724473003500)

messa commented 4 years ago

The problem is probably here 🙂

https://github.com/messa/pyladies-courseware/blob/29e72837fa20dcec37f070d790eff087be63a26e/backend/cw_backend/courses/loaders.py#L70-L77

messa commented 4 years ago

@encukou The Naucse API is generated as static site, right? Would it be possible to add some "build timestamp" value so it could be easily detected that something changed without having to HEAD many files instead?

encukou commented 4 years ago

I opened https://github.com/pyvec/naucse/issues/28 for that.

Would a webhook notification for each build help as well?

encukou commented 4 years ago

The API now gives you an etag for each course.

(You could also use the last commit of the gh-pages branch of pyvec/naucse.python.cz as an etag for the whole site, but this will only work as long as naucse is a static site.)