Skip to content

Commit

Permalink
logging and adding read-only mode to avoid write locks
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Dec 3, 2024
1 parent 87527a8 commit e80412f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pioreactor/actions/leader/backup_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ def backup_database(output_file: str, force: bool = False, backup_to_workers: in

logger.debug(f"Starting backup of database to {output_file}")

if not force and count_writes_occurring() >= 2:
if not force and count_writes_occurring() >= 10:
logger.debug("Too many writes to proceed with backup. Exiting. Use --force to force backing up.")
return

current_time = current_utc_timestamp()
page_size = 50

con = sqlite3.connect(config.get("storage", "database"))
con = sqlite3.connect(f"file:{config.get('storage', 'database')}?mode=ro", uri=True)
bck = sqlite3.connect(output_file)

with bck:
Expand Down

0 comments on commit e80412f

Please sign in to comment.