mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
fix(docsync): an orphaned binding stays stopped on every path that starts a run
This commit is contained in:
@@ -112,6 +112,7 @@ export class DocSyncService {
|
||||
.prepare(
|
||||
`SELECT * FROM trip_document_links
|
||||
WHERE sync_enabled = 1
|
||||
AND last_sync_state != 'orphaned'
|
||||
AND failure_count < ?
|
||||
AND (next_attempt_at IS NULL OR next_attempt_at <= CURRENT_TIMESTAMP)
|
||||
AND provider_id IN (SELECT id FROM document_providers WHERE enabled = 1)
|
||||
@@ -176,6 +177,12 @@ export class DocSyncService {
|
||||
if (this.isSwitchedOff(link)) {
|
||||
return { state: 'disabled', pulled: 0, pushed: 0, conflicts: 0, missing: 0 };
|
||||
}
|
||||
// An orphaned binding runs for nobody. Its credential belongs to somebody
|
||||
// who has left the trip, and a webhook or a resolved conflict reach this
|
||||
// without asking beforehand.
|
||||
if (this.config.isOrphaned(link)) {
|
||||
return { state: 'orphaned', pulled: 0, pushed: 0, conflicts: 0, missing: 0 };
|
||||
}
|
||||
const conn = this.config.getConnection(link.connection_id);
|
||||
if (!conn) {
|
||||
this.recordLinkFailure(link, 'not_found');
|
||||
|
||||
Reference in New Issue
Block a user