Show when a QuickBooks sync is running

Syncs record their state in a new qbo_sync_statuses table: queued when asked for, running with how
many records have been read, removed when finished (stale rows are ignored after 6 hours). The
business report says when estimates, invoices or payments are still syncing and refreshes every 30
seconds until they finish; the settings page's Synchronization table shows the same per type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-31 10:03:12 -04:00
1 parent bf7c7b0905
commit 28538d4c7f
11 files changed
+158 -4

No files matched your search

+4 -1
View File
@@ -40,7 +40,10 @@ class QboSyncDispatcher
end
end
jobs.each { |job| QboSyncJob.perform_later(entity: job, full_sync: full_sync) }
jobs.each do |job|
QboSyncStatus.queued(job.to_s)
QboSyncJob.perform_later(entity: job, full_sync: full_sync)
end
end
def self.log(msg)
+7 -1
View File
@@ -25,7 +25,13 @@ class QboSyncJob < ApplicationJob
elsif doc_number.present?
service.sync_by_doc_number(doc_number)
else
service.sync(full_sync: full_sync)
# Shown on the business report and the settings page while it runs
QboSyncStatus.running(entity)
begin
service.sync(full_sync: full_sync)
ensure
QboSyncStatus.finished(entity)
end
end
end