Anonymous
public python v1 · immutable def insert_couchdb(self, msg): #XXX skip saving to couchdb return True doc_id = uuid4().hex # What happens if this fails? try: msg['_id'] = doc_id self.ipdb.save(msg) except ResourceConflict: logging.warn('Possible doc save failure id: %s db: %s' % (doc_id, self.ipdb.name)) #time.sleep(6) if not self.get_couchdoc(self.ipdb, doc_id): logging.warn('Failed save a doc with id %s db: %s' % (doc_id, self.ipdb.name)) logging.debug('%s %s' % (doc_id, msg)) return False except: logging.error('Unknown exception while trying to save document id: %s db: %s' % (doc_id, self.ipdb.name)) return False return True