def handle(self, *args, **options): # this has a verrrrrrrrry similar structure to the conflict resolver. # we should abstract this out into a base management command class db = get_db() c = Consumer(db) def add_sha1_to_line(line): try: xform_id = line["id"] xform = CXFormInstance.get(xform_id) add_sha1(None, xform) except Exception: logging.exception("problem with sha1 callback") # Go into receive loop waiting for any conflicting patients to # come in. while True: try: c.wait(add_sha1_to_line, heartbeat=5000, filter=FILTER_XFORMS) except Exception, e: time.sleep(10) logging.warn("caught exception in sha-1 adder: %s, sleeping and restarting" % e)
def spool(): update_seq = cq.db.info()["update_seq"] c = Consumer(cq.db) c.wait(run_item, since=update_seq)
def spool(): update_seq = cq.db.info()['update_seq'] c = Consumer(cq.db) c.wait(run_item, since=update_seq)