apenwarr-redo/t/flush-cache
Avery Pennarun 94c254de77 Rename flush-cache.py to flush-cache, and rearrange the code a bit.
It was working fine, but the style wasn't exactly the way I like it, because
I'm unnecessarily picky. :)

Also, removed the file extension since we should probably learn from the
fact that it's already been rewritten once from one language to another.
Who knows, maybe it will be again someday.
2011-02-23 01:27:41 -08:00

16 lines
511 B
Python
Executable file

#!/usr/bin/env python
import sys, os, sqlite3
if "DO_BUILT" in os.environ:
sys.exit(0)
sys.stderr.write("Flushing redo cache...\n")
db_file = os.path.join(os.environ["REDO_BASE"], ".redo/db.sqlite3")
db = sqlite3.connect(db_file, timeout=5000)
db.executescript("pragma synchronous = off;"
"update Files set checked_runid=checked_runid-1, "
" changed_runid=changed_runid-1, "
" failed_runid=failed_runid-1;")
db.commit()