Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/sqlrsync/sqlrsync.com/sync"
)

var VERSION = "0.0.6"
var VERSION = "0.0.7"
var (
serverURL string
verbose bool
Expand Down
3 changes: 3 additions & 0 deletions client/subscription/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions client/sync/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions examples/earthquakes/gov.usgs.earthquakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading