CreateForkNetworkMembershipsRange jobs execute repeatedly

Description

After kicking off a background migration a set of Gitlab::BackgroundMigration::CreateForkNetworkMembershipsRange jobs are being scheduled repeatedly. The start and end argument were always the same.

"CreateForkNetworkMembershipsRange", [2306, 2427]
Project.where("id IN 
(#{ForkedProjectLink.select(:forked_to_project_id).to_sql}) OR id IN 
(#{ForkedProjectLink.select(:forked_from_project_id).to_sql})").count 
=> 2841 
ForkNetworkMember.count 
=> 2622

This query keeps returning 1. Another thing is that project 2306 doesn't exist.

Possible solutions

Should we consider not scheduling this worker if the arguments have not changed?

https://gitlab.zendesk.com/agent/tickets/98626

Edited by 🤖 GitLab Bot 🤖