JustZack / audit-congress

A website collecting & displaying information about the activities of congress.
0 stars 0 forks source link

Decide who updates `CacheStatus` table #87

Open JustZack opened 5 months ago

JustZack commented 5 months ago

previously this was on the python scripts. It then shifted to the API to take advantage of the CacheTracker class. However, there are cases where the API can (and should) timeout causing the CacheStatus row to never be updated, and the cache to continually be updated.

Make some fix or decide definitively if the API or the python scripts should update their rows in CacheStatus

A temporary fix in the Cache Tracker class extends the PHP script timeout to 5 minutes to avoid this temporarily.

JustZack commented 5 months ago

NOTE: temporarily make the php script timeout 5 minutes to fix this while developing.

Thought for this right now is:

  1. PHP starts running the script.
  2. For long runs (bills), immediately return with a status indicating we are waiting for cache update
  3. For short runs (members), wait up to X seconds.
  4. Return old data if the cache is still running.
  5. New API public Route: cacheStatus - allow the front-end to check-in on the given cache
  6. New API system Route: cacheRunComplete - Allow scripts to let the backend know when they finished running & update CacheStatus row accordingly