fix: contraint conflict

This commit is contained in:
Richard Ramos 2024-08-22 16:34:45 -04:00
parent 4378920387
commit 872df40bba
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
2 changed files with 5 additions and 2 deletions

View File

@ -534,7 +534,10 @@ func (app *Application) fetchStoreNodeMessages(ctx context.Context, runId string
cursorLogger.Error("could not query storenode", zap.Error(err))
time.Sleep(2 * time.Second)
} else {
cursorLogger.Info("more messages available", zap.Int("len", len(result.Messages())))
msgLen := len(result.Messages())
if msgLen != 0 {
cursorLogger.Info("more messages available", zap.Int("len", msgLen))
}
retry = false
success = true
}

View File

@ -279,7 +279,7 @@ func (d *DBStore) GetMissingMessages(from time.Time, to time.Time) (map[peer.ID]
}
func (d *DBStore) UpdateTopicSyncState(tx *sql.Tx, topic string, lastSyncTimestamp time.Time) error {
_, err := tx.Exec("INSERT INTO syncTopicStatus(fleet, clusterId, pubsubTopic, lastSyncTimestamp) VALUES ($1, $2, $3, $4) ON CONFLICT(fleet, clusterId, pubsubTopic) DO UPDATE SET lastSyncTimestamp = $5", d.fleetName, d.clusterID, topic, lastSyncTimestamp.UnixNano(), lastSyncTimestamp.UnixNano())
_, err := tx.Exec("INSERT INTO syncTopicStatus(fleet, clusterId, pubsubTopic, lastSyncTimestamp) VALUES ($1, $2, $3, $4) ON CONFLICT(clusterId, pubsubTopic) DO UPDATE SET lastSyncTimestamp = $5", d.fleetName, d.clusterID, topic, lastSyncTimestamp.UnixNano(), lastSyncTimestamp.UnixNano())
return err
}