Skip to content

campaigns: Improve sync timing logic for webhooks

Administrator requested to merge sync-webhook-backoff into master

Created by: ryanslade

The old logic would cause us to always immedietly sync when a webhook arrived more than two minutes after our most recent sync. The time difference between the sync and event would be negative which would cause our next sync to occur in the past, forcing it to run now.

Instead, when the time difference in negative we now use the latest event as the "base" time. This also has the nice property that if we receive a batch of webhook events in close succession we'll wait until a quiet period until we do our full sync.

Merge request reports

Loading