Add bi-directional site replication with LWW conflict resolution

This commit is contained in:
2026-01-24 19:38:17 +08:00
parent 7a8acfb933
commit 23ea164215
6 changed files with 902 additions and 9 deletions

View File

@@ -208,6 +208,20 @@ def create_app(
system_metrics_collector.set_storage(storage)
app.extensions["system_metrics"] = system_metrics_collector
site_sync_worker = None
if app.config.get("SITE_SYNC_ENABLED", False):
from .site_sync import SiteSyncWorker
site_sync_worker = SiteSyncWorker(
storage=storage,
connections=connections,
replication_manager=replication,
storage_root=storage_root,
interval_seconds=app.config.get("SITE_SYNC_INTERVAL_SECONDS", 60),
batch_size=app.config.get("SITE_SYNC_BATCH_SIZE", 100),
)
site_sync_worker.start()
app.extensions["site_sync"] = site_sync_worker
@app.errorhandler(500)
def internal_error(error):
return render_template('500.html'), 500