@keeprunning(NSQ_READY_CHECK_INTERVAL,<EOL>exit_on_success=True,<EOL>on_error=util.log_exception)<EOL><INDENT>def _is_ready(self, topic_name):<DEDENT>
url = '<STR_LIT>' % (self.nsqd_http_address, topic_name)<EOL>if '<STR_LIT:#>' in topic_name:<EOL><INDENT>topic_name, tag =topic_name.split("<STR_LIT:#>", <NUM_LIT:1>)<EOL><DEDENT>try:<EOL><INDENT>data = self.session.get(url).json()<EOL>'''<STR_LIT>'''<EOL>topics = data.get('<STR_LIT>', [])<EOL>topics = [t for t in topics if t['<STR_LIT>'] == topic_name]<EOL>if not topics:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>topic = topics[<NUM_LIT:0>]<EOL>depth = topic['<STR_LIT>']<EOL>depth += sum(c.get('<STR_LIT>', <NUM_LIT:0>) for c in topic['<STR_LIT>'])<EOL>self.log.debug('<STR_LIT>', topic=topic_name,<EOL>depth=depth, max_depth=self.nsq_max_depth)<EOL>if depth < self.nsq_max_depth:<EOL><INDENT>return<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT><DEDENT>except:<EOL><INDENT>raise<EOL><DEDENT>
Is NSQ running and have space to receive messages?