diff --git a/client/subscription/manager.go b/client/subscription/manager.go index 7f75f03..dc0eedb 100644 --- a/client/subscription/manager.go +++ b/client/subscription/manager.go @@ -481,6 +481,9 @@ func (m *Manager) readLoop() { } var msg Message + if string(data) == "PING" || string(data) == "PONG" { + return + } if err := json.Unmarshal(data, &msg); err != nil { m.logger.Warn("Failed to unmarshal message", zap.Error(err)) continue diff --git a/client/sync/coordinator.go b/client/sync/coordinator.go index 7deedbb..4c40637 100644 --- a/client/sync/coordinator.go +++ b/client/sync/coordinator.go @@ -861,7 +861,7 @@ func (c *Coordinator) executePushSubscribe() error { fmt.Println("⚠️ Warning: Could not set up pull subscription - will only push changes") } else { defer c.subManager.Close() - fmt.Println("✅ Subscribed to remote updates - will pull new versions automatically") + fmt.Println("✅ Subscribed to remote updates at " + time.Unix(time.Now().Unix(), 0).String() + " - will pull new versions automatically") // Start goroutine to handle pull notifications go c.handlePullNotifications() @@ -1131,7 +1131,7 @@ func (c *Coordinator) executeAutoMerge(localClient *bridge.BridgeClient, remoteC AuthKey: authResult.AccessKey, ReplicaID: authResult.ReplicaID, Timeout: 8000, - PingPong: false, + PingPong: true, Logger: c.logger.Named("merge-pull"), Version: latestVersion, ClientVersion: c.config.ClientVersion, diff --git a/examples/earthquakes/gov.usgs.earthquakes.sh b/examples/earthquakes/gov.usgs.earthquakes.sh index cb1529a..9ea9ba1 100755 --- a/examples/earthquakes/gov.usgs.earthquakes.sh +++ b/examples/earthquakes/gov.usgs.earthquakes.sh @@ -11,7 +11,7 @@ URL=https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.csv URL=https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.csv # Disabled so we can use file watching -#SQLRSYNC_PATH=usgs.gov/earthquakes.db +SQLRSYNC_PATH=usgs.gov/earthquakes.db PRIMARY_KEY=id MODE="INSERT OR REPLACE INTO" SCHEMA="time TEXT, latitude REAL, longitude REAL, depth REAL, mag REAL, magType TEXT, nst INTEGER, gap REAL, dmin REAL, rms REAL, net TEXT, id TEXT PRIMARY KEY, updated TEXT, place TEXT, type TEXT, horizontalError REAL, depthError REAL, magError REAL, magNst INTEGER, status TEXT, locationSource TEXT, magSource TEXT" @@ -81,9 +81,9 @@ EOF sqlite3 "$FILE" "SELECT time, mag, place FROM $TABLE ORDER BY time DESC LIMIT 3;" 2>/dev/null | head -3 # Sync to SQLRsync server if path is configured - if [ -n "$SQLRSYNC_PATH" ] && command -v sqlrsync >/dev/null 2>&1; then + if [ -n "$SQLRSYNC_PATH" ] && command -v sqlrsync >/dev/null 2>&1 && [ "${new_records}" -gt 0 ]; then echo "Syncing to SQLRsync server: $SQLRSYNC_PATH" - sqlrsync "$FILE" "$SQLRSYNC_PATH" -m "Added $new_records records, others updated" + sqlrsync "$FILE" "$SQLRSYNC_PATH" -m "Added $new_records earthquakes" if [ $? -eq 0 ]; then echo "Successfully synced to server" else