Skip to content

Fix CardinalityViolation in grab_next_visits on duplicate origins

grab_next_visits grabs from listed_origins, whose primary key is (lister_id, url, visit_type) and uses it to upsert in origin_visit_stats, whose primary key is (url, visit_type). This causes the error ON CONFLICT DO UPDATE command cannot affect row a second time when the same (origin, type) pair is grabbed twice.

This commit deduplicates the (origin, type) pairs before upserting.

Resolves SWH-SCHEDULER-6A


Migrated from D6664 (view on Phabricator)

Merge request reports