code: def clean_queues(self):
          if getattr(self.pushed_conf, 'tick_clean_queues', 0) == 0:
              logger.debug("No queues cleaning...")
              return
          max_checks = MULTIPLIER_MAX_CHECKS * (len(self.hosts) + len(self.services))
          max_broks = MULTIPLIER_MAX_BROKS * (len(self.hosts) + len(self.services))
          max_actions = MULTIPLIER_MAX_ACTIONS * len(self.contacts) * (len(self.hosts) +
                                                                       len(self.services))
          self.nb_checks_dropped = 0
          if max_checks and len(self.checks) > max_checks:
              to_del_checks = [c for c in list(self.checks.values())]
              to_del_checks.sort(key=lambda x: x.creation_time)
              to_del_checks = to_del_checks[:-max_checks]
              self.nb_checks_dropped = len(to_del_checks)
              if to_del_checks:
                  logger.warning("I have to drop some checks (%d)..., sorry :(",
                                 self.nb_checks_dropped)
              for chk in to_del_checks:
                  c_id = chk.uuid
                  items = getattr(self, chk.ref_type + 's')
                  elt = items[chk.ref]
                  elt.remove_in_progress_check(chk)
                  for dependent_checks in chk.depend_on_me:
                      dependent_checks.depend_on.remove(chk.uuid)
                  for c_temp in chk.depend_on:
                      c_temp.depend_on_me.remove(chk)
                  del self.checks[c_id]
          self.nb_broks_dropped = 0
          for broker_link in list(self.my_daemon.brokers.values()):
              if max_broks and len(broker_link.broks) > max_broks:
                  logger.warning("I have to drop some broks (%d > %d) for the broker %s "
                                 "..., sorry :(", len(broker_link.broks), max_broks, broker_link)
                  kept_broks = sorted(broker_link.broks, key=lambda x: x.creation_time)
                  broker_link.broks = kept_broks[0:max_broks]
          self.nb_actions_dropped = 0
          if max_actions and len(self.actions) > max_actions:
              logger.warning("I have to del some actions (currently: %d, max: %d)..., sorry :(",
                             len(self.actions), max_actions)
              to_del_actions = [c for c in list(self.actions.values())]
              to_del_actions.sort(key=lambda x: x.creation_time)
              to_del_actions = to_del_actions[:-max_actions]
              self.nb_actions_dropped = len(to_del_actions)
              for act in to_del_actions:
                  if act.is_a == 'notification':
                      self.find_item_by_id(act.ref).remove_in_progress_notification(act)
                  del self.actions[act.uuid]