Since the code snapshots are not going to be stored indefinitely, the status check should use test file existence instead of a database flag. The snapshot should be generated with a temporary file name, and atomically renamed to the final file name when complete. The status check should return
'ready' if the final file name exists,
'busy' if the temporary file name exists, and
None (and thus initiate a new build) if neither exist.
Additionally, since the snapshot could take a while to build, the delay between status checks should decay from a short delay to a much longer one, on the order of minutes or tens of minutes, instead of being a fixed 5s.