Skip to content

Commit 36ad53e

Browse files
authored
Merge pull request #30 from sqlrsync/v0.0.7
v0.0.7 release - enable pingpong on subscribe and adjust logging level
2 parents a9cfe7c + 1946456 commit 36ad53e

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/sqlrsync/sqlrsync.com/sync"
1616
)
1717

18-
var VERSION = "0.0.6"
18+
var VERSION = "0.0.7"
1919
var (
2020
serverURL string
2121
verbose bool

client/subscription/manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ func (m *Manager) readLoop() {
481481
}
482482

483483
var msg Message
484+
if string(data) == "PING" || string(data) == "PONG" {
485+
return
486+
}
484487
if err := json.Unmarshal(data, &msg); err != nil {
485488
m.logger.Warn("Failed to unmarshal message", zap.Error(err))
486489
continue

client/sync/coordinator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ func (c *Coordinator) executePushSubscribe() error {
861861
fmt.Println("⚠️ Warning: Could not set up pull subscription - will only push changes")
862862
} else {
863863
defer c.subManager.Close()
864-
fmt.Println("✅ Subscribed to remote updates - will pull new versions automatically")
864+
fmt.Println("✅ Subscribed to remote updates at " + time.Unix(time.Now().Unix(), 0).String() + " - will pull new versions automatically")
865865

866866
// Start goroutine to handle pull notifications
867867
go c.handlePullNotifications()
@@ -1131,7 +1131,7 @@ func (c *Coordinator) executeAutoMerge(localClient *bridge.BridgeClient, remoteC
11311131
AuthKey: authResult.AccessKey,
11321132
ReplicaID: authResult.ReplicaID,
11331133
Timeout: 8000,
1134-
PingPong: false,
1134+
PingPong: true,
11351135
Logger: c.logger.Named("merge-pull"),
11361136
Version: latestVersion,
11371137
ClientVersion: c.config.ClientVersion,

examples/earthquakes/gov.usgs.earthquakes.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ URL=https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.csv
1111
URL=https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.csv
1212

1313
# Disabled so we can use file watching
14-
#SQLRSYNC_PATH=usgs.gov/earthquakes.db
14+
SQLRSYNC_PATH=usgs.gov/earthquakes.db
1515
PRIMARY_KEY=id
1616
MODE="INSERT OR REPLACE INTO"
1717
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
8181
sqlite3 "$FILE" "SELECT time, mag, place FROM $TABLE ORDER BY time DESC LIMIT 3;" 2>/dev/null | head -3
8282

8383
# Sync to SQLRsync server if path is configured
84-
if [ -n "$SQLRSYNC_PATH" ] && command -v sqlrsync >/dev/null 2>&1; then
84+
if [ -n "$SQLRSYNC_PATH" ] && command -v sqlrsync >/dev/null 2>&1 && [ "${new_records}" -gt 0 ]; then
8585
echo "Syncing to SQLRsync server: $SQLRSYNC_PATH"
86-
sqlrsync "$FILE" "$SQLRSYNC_PATH" -m "Added $new_records records, others updated"
86+
sqlrsync "$FILE" "$SQLRSYNC_PATH" -m "Added $new_records earthquakes"
8787
if [ $? -eq 0 ]; then
8888
echo "Successfully synced to server"
8989
else

0 commit comments

Comments
 (0)