docs: def recalc_concurrency(self):
          '''Call to recalculate sleeps and concurrency for the session.  Called automatically if
          cost has drifted significantly.  Otherwise can be called at regular intervals if
          desired.
          '''
          # Refund resource usage proportionally to elapsed time; the bump passed is negative
          now = time.time()
          self.cost = max(0, self.cost - (now - self._cost_time) * self.cost_decay_per_sec)
          self._cost_time = now
          self._cost_last = self.cost
  
          # Setting cost_hard_limit <= 0 means to not limit concurrency
          value = self._incoming_concurrency.max_concurrent
          cost_soft_range = self.cost_hard_limit - self.cost_soft_limit
          if cost_soft_range <= 0:
              return
  
          cost = self.cost + self.extra_cost()
          self._cost_fraction = max(0.0, (cost - self.cost_soft_limit) / cost_soft_range)
  
          target = max(0, ceil((1.0 - self._cost_fraction) * self.initial_concurrent))
          if abs(target - value) > 1:
              self.logger.info(f'changing task concurrency from {value} to {target}')
          self._incoming_concurrency.set_target(target)