fix: requeue orphaned pending configurations; independent background sync streams
- Configurations stuck in sync_status=pending without a pending_changes row are re-enqueued as an update with the current snapshot on each push cycle. - Background cycle no longer aborts pricelist/partbook/settings sync when push or readiness fails; each stream logs its own error. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
310b296045
commit
cccb8890a4
5 files changed
+143
-11
No files matched your search
@@ -1862,6 +1862,17 @@ func (l *LocalDB) MarkChangesSynced(ids []int64) error {
|
||||
return l.db.Where("id IN ?", ids).Delete(&PendingChange{}).Error
|
||||
}
|
||||
|
||||
// ListConfigurationsPendingWithoutQueue returns configurations still marked pending
|
||||
// whose pending_changes rows are gone, so nothing will ever push them.
|
||||
func (l *LocalDB) ListConfigurationsPendingWithoutQueue() ([]LocalConfiguration, error) {
|
||||
var configs []LocalConfiguration
|
||||
err := l.db.Where(
|
||||
"sync_status = ? AND uuid NOT IN (SELECT entity_uuid FROM pending_changes WHERE entity_type = ?)",
|
||||
"pending", "configuration",
|
||||
).Find(&configs).Error
|
||||
return configs, err
|
||||
}
|
||||
|
||||
// PurgeOrphanConfigurationPendingChanges removes configuration pending changes
|
||||
// whose entity_uuid no longer exists in local_configurations.
|
||||
func (l *LocalDB) PurgeOrphanConfigurationPendingChanges() (int64, error) {
|
||||
|
||||
Reference in new issue
Block a user