(maint) Extract invariant lookups in request limit middleware
(maint) Extract invariant lookups in request limit middleware

Prior to this patch, there were a few lookups within the handler function
produced by `wrap-with-request-queue-limit` that were executed for each
request despite the returned values never changing. This patch re-factors
the implementation so that metric objects and error messages are looked
up once and then referenced within the closure formed by the returned handler.

puppetlabs/puppet-server,puppetlabs/puppetserver,puppetlabs/puppetserver,puppetlabs/puppetserver,puppetlabs/puppet-server,puppetlabs/puppet-server,puppetlabs/puppetserver