def METHOD_NAME(self, sack, blocking=False, sync=False):
    """Process added measures in background.
    Lock a sack and try to process measures from it. If the sack cannot be
    locked, the method will raise `SackAlreadyLocked`.
    :param sack: The sack to process new measures for.
    :param blocking: Block to be sure the sack is processed or raise
                     `SackAlreadyLocked` otherwise.
    :param sync: If True, raise any issue immediately otherwise just log it
    :return: The number of metrics processed.
    """
    lock = self.get_sack_lock(sack)
    if not lock.acquire(blocking=blocking):
        raise SackAlreadyLocked(sack)
    LOG.debug("Processing measures for sack %s", sack)
    try:
        with self.incoming.process_measures_for_sack(sack) as measures:
            # process only active metrics. deleted metrics with unprocessed
            # measures will be skipped until cleaned by janitor.
            if not measures:
                return 0
            metrics = self.index.list_metrics(
                attribute_filter={
                    "in": {"id": measures.keys()}
                })
            self.storage.add_measures_to_metrics({
                metric: measures[metric.id]
                for metric in metrics
            })
            LOG.debug("Measures for %d metrics processed",
                      len(metrics))
            return len(measures)
    except Exception:
        if sync:
            raise
        LOG.error("Error processing new measures", exc_info=True)
        return 0
    finally:
        lock.release()