def collect(self):
        if self._get_dlock():
            try:
                children = self._zk.get_children('/queue/consumers', None)
                for child in children:
                    cpath = '/queue/consumers/' + child 
                    if not self._zk.exists(cpath + '/active'):
                        (data, stat) = self._zk.get(cpath, None)
                        if stat['ctime'] < 1000*(time.time() - 300): # 5 minutes
                            (data, stat) = self._zk.get(cpath + '/item', None)
                            if data:
                                self._zk.create_sequence('/queue/partial/item-', data)

                            try:
                                self._zk.delete(cpath + '/item')
                            except zookeeper.NoNodeException: pass # already removed

                            try:
                                self._zk.delete(cpath)
                            except zookeeper.NoNodeException: pass # already removed
            finally:
                self._remove_dlock()
dataset/ETHPy150Open andreisavu/zookeeper-mq/zkmq.py/GarbageCollector.collect/original