def shrink(self, amount):
        # Grow/shrink the pool if necessary.
        # Remove any dead threads from our list
        for t in self._threads:
            if not t.isAlive():
                self._threads.remove(t)
                amount -= 1
        
        if amount > 0:
            for i in xrange(min(amount, len(self._threads) - self.min)):
                # Put a number of shutdown requests on the queue equal
                # to 'amount'. Once each of those is processed by a worker,
                # that worker will terminate and be culled from our list
                # in self.put.
                self._queue.put(_SHUTDOWNREQUEST)
Start a thread to flush metrics.
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/wsgiserver.py/ThreadPool.shrink--crossover with--dataset/ETHPy150Open DataDog/datadogpy/datadog/threadstats/base.py/ThreadStats._start_flush_thread