Python CouchDB连接丢失,无错误
这个程序是用Python开发的。它包含对远程CouchDB数据库的大量查询。程序开始运行,过了一段时间,它就冻结了。当我检查连接时,我发现CouchDB数据库连接已经丢失。它仍然不用做任何事情就使用CPU,看起来是这样的Python CouchDB连接丢失,无错误,python,couchdb-python,Python,Couchdb Python,这个程序是用Python开发的。它包含对远程CouchDB数据库的大量查询。程序开始运行,过了一段时间,它就冻结了。当我检查连接时,我发现CouchDB数据库连接已经丢失。它仍然不用做任何事情就使用CPU,看起来是这样的 def addNewDnsRecord(self, record): if self.checkHashValue(record['hashValue']): .... #some cod
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中是否建立了连接或丢失了连接
连接丢失的原因可能是什么?CouchDB没有状态连接,它只是对HTTP/REST API的单个请求,因此这根本不是CouchDB的问题——是您的python库在进行某种连接缓存。所以,我用couchdb-python-one替换了couchdb标记。当你找到答案的时候,看到一个答案回到这里会很好,但是如果这仍然是一个bug,你可能会尝试或者他们的邮件列表。