candlepin/candlepin — pull request #151 by dgoodwin (2013-01-04 16:35:47+00:00)
Title: 886211: Fix duplicate pinsetter jobs on every config change.

Changing schedule of a pinsetter job was resulting in duplicate jobs all
still live in the database. Delete was using the wrong job key and
actually not deleting anything.

In addition this fixes existing deployments where the database already
has duplicates.

New logic: if there is only one existing job for the class and it's
schedule matches our config, then nothing needs it to be done. Otherwise
we delete all existing jobs for the class and add a new one with correct
schedule. There should be only one going forward, though we will detect
and fix dupes should it ever happen again.