(PDB-2478) services: extract gc code
(PDB-2478) services: extract gc code

Move the gc/maintenance code to a separate function.

senior/puppetdb,mullr/puppetdb,rbrw/puppetdb,waynr/puppetdb,mullr/puppetdb,puppetlabs/puppetdb,mullr/puppetdb,rbrw/puppetdb,senior/puppetdb,rbrw/puppetdb,puppetlabs/puppetdb,waynr/puppetdb,waynr/puppetdb,puppetlabs/puppetdb,mullr/puppetdb,senior/puppetdb,kbarber/puppetdb,kbarber/puppetdb,rbrw/puppetdb,puppetlabs/puppetdb,rbrw/puppetdb,mullr/puppetdb,kbarber/puppetdb,waynr/puppetdb,senior/puppetdb,puppetlabs/puppetdb,kbarber/puppetdb