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
@@ -71,28 +71,22 @@ func (w *Worker) runSync() {
|
||||
return
|
||||
}
|
||||
|
||||
// Each stream is independent: a failure in one must not stop the others.
|
||||
// Readiness only gates pushing local changes to the server.
|
||||
if readiness, err := w.service.EnsureReadinessForSync(); err != nil {
|
||||
w.logger.Warn("background sync: blocked by readiness guard",
|
||||
w.logger.Warn("background sync: push blocked by readiness guard",
|
||||
"error", err,
|
||||
"reason_code", readiness.ReasonCode,
|
||||
"reason_text", readiness.ReasonText,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Push pending changes first
|
||||
pushed, err := w.service.PushPendingChanges()
|
||||
if err != nil {
|
||||
} else if pushed, err := w.service.PushPendingChanges(); err != nil {
|
||||
w.logger.Warn("background sync: failed to push pending changes", "error", err)
|
||||
} else if pushed > 0 {
|
||||
w.logger.Info("background sync: pushed pending changes", "count", pushed)
|
||||
}
|
||||
|
||||
// Then check for new pricelists
|
||||
err = w.service.SyncPricelistsIfNeeded()
|
||||
if err != nil {
|
||||
if err := w.service.SyncPricelistsIfNeeded(); err != nil {
|
||||
w.logger.Warn("background sync: failed to sync pricelists", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Pull partnumber books together with pricelists
|
||||
|
||||
Reference in new issue
Block a user