简体   繁体   English

如何在 Couchbase NodeJS SDK 3X 中设置 operationTimeout?

[英]How to set operationTimeout in Couchbase NodeJS SDK 3X?

I used CouchBase NodeJS SDK 2.6.10 previously and setting operationTimeout was something like this:我以前使用过 CouchBase NodeJS SDK 2.6.10并且设置operationTimeout是这样的:

const couchbase = require('couchbase')

var cluster = new couchbase.Cluster('couchbase://XXXXXXXXXXXXXXXXXXX');

cluster.authenticate('USERNAME', 'PASSWORD')

var bucket = cluster.openBucket('statistics')

**bucket.operationTimeout = 3600000**

But, now in SDK 3.0.4 , it's a bit different, like:但是,现在在SDK 3.0.4中,它有点不同,比如:

const couchbase = require('couchbase')

const cluster = new couchbase.Cluster('couchbase://XXXXXXXXXXXXXXXXXXX', {

    username: 'USERNAME',

    password: 'PASSWORD'

})

const bucket = cluster.bucket('statistics')

const collection = bucket.defaultCollection()

Here, I'm not finding any option to set operationTimeout from.在这里,我没有找到任何设置operationTimeout的选项。 Does anybody know anything about it?有人知道吗?

I can see they have timeout options for their latest nodejs sdk 3.1 but not for v3.0我可以看到他们的最新 nodejs sdk 3.1 有超时选项,但 v3.0 没有

api ref: https://docs.couchbase.com/sdk-api/couchbase-node-client/Cluster.html api 参考: https://docs.couchbase.com/sdk-api/couchbase-node-client/Cluster.html

Posting from the thread mentioned by Matthew.从马修提到的线程发布。

For v3.1,对于 v3.1,

const couchbase = require(‘couchbase’);

await couchbase.connect(‘couchbase://XXXXXXXXXXXXXXXXXXX’, {
 username: 'USERNAME',
 password: 'PASSWORD',
 kvTimeout: 3600000,
 kvDurableTimeout: 3600000,
 viewTimeout: 3600000,
 queryTimeout: 3600000,
 analyticsTimeout: 3600000,
 searchTimeout: 3600000,
 managementTimeout: 3600000
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM