CouchDB 链接丢失

2024-10-01 17:32:33 发布

您现在位置:Python中文网/ 问答频道 /正文

这个程序正在用Python开发。它包含对远程CouchDB数据库的大量查询。程序开始运行,过了一段时间,就冻结了。当我检查连接时,我发现CouchDB数据库连接已经丢失。它仍然在不做任何事情的情况下使用CPU(看起来是这样)。你知道吗

def addNewDnsRecord(self, record):
     if self.checkHashValue(record['hashValue']):
         ....                                #some code to generate an id
         record['_id'] = tempid
         self.bulk.append(record)            #add record at the end of the bulk

         if len(self.bulk) == 1000:          #bulk with 1000 records are inserted
              self.dns_db.update(self.bulk)
              self.bulk = []

def checkHashValue(self, hashValue):
    result = self.dns_db.view('records/hashcheck', None, key=hashValue)
    if len(result) == 0:
          return True
    else:
          return False

其次,有没有一种方法可以检查CouchDB python中是否建立了连接或丢失了连接。你知道吗

连接丢失的原因是什么?你知道吗


Tags: theself程序id数据库lenifdns

热门问题