Azure Storage NodeJS 修改默认超时设置

Azure Storage NodeJS modify default timeout settings

我想知道我是否可以更改 Azure Storage BlobService 的默认超时设置。从文档中我可以看到默认设置是:

查看源代码,我看到 BlobService.getServiceProperties 和 setServiceProperties 列出了这两个参数:

这两个参数是否等于上面的项目?

现在,当我尝试使用以下代码使用 getServiceProperties 时,除了日志记录、指标和 cors 数据外,我没有得到任何信息。 Github 页面

上说的是什么
blobSvc.getServiceProperties(function(error, result, response) {
    if (!error) {
        console.log('Result: ', result);
        console.log('Response: ', response);
    } else {
        console.log(error);
    }
});

Result:  { Logging:
   { Version: '1.0',
     Delete: false,
     Read: false,
     Write: false,
     RetentionPolicy: { Enabled: false } },
  HourMetrics:
   { Version: '1.0',
     Enabled: true,
     IncludeAPIs: true,
     RetentionPolicy: { Enabled: true, Days: 7 } },
  MinuteMetrics:
   { Version: '1.0',
     Enabled: false,
     RetentionPolicy: { Enabled: false } },
  Cors: {} }
Response:  { isSuccessful: true,
  statusCode: 200,
  body:
   { StorageServiceProperties:
      { Logging: [Object],
        HourMetrics: [Object],
        MinuteMetrics: [Object],
        Cors: '' } },
  headers:
   { 'transfer-encoding': 'chunked',
     'content-type': 'application/xml',
     server: 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0',
     'x-ms-request-id': '45a3cfeb-0001-0127-0cf7-0149a8000000',
     'x-ms-version': '2015-02-21',
     date: 'Thu, 08 Oct 2015 18:32:36 GMT',
     connection: 'close' },
  md5: undefined }

所以我想我真的对文档之间的不匹配以及是否有可能修改任何超时设置感到困惑。

超时设置不是 'properties associated with the service',而是 'properties associated with a call to the Storage Library'。 timeoutIntervalInMs 设置和 maximumExecutionTimeInMs 设置是您可以在 'options' 对象上设置的参数,几乎每个操作(包括上传和下载 blob)都可以传入。因此,如果您想修改给定操作的超时,只需在调用库时在 'options' 对象上传递所需的设置即可。

'timeoutIntervalInMs' 是发送到 Azure 存储服务的请求中的超时。这是服务在超时前尝试完成请求所花费的时间。这是您在此处提到的文档中的设置 - https://msdn.microsoft.com/en-us/library/azure/dd179431.aspx 如果对存储客户端的调用向存储服务发出多个 HTTP(S) 请求,则每次调用都会传递此值。

'maximumExecutionTimeInMs' 是客户端超时。这是由存储客户端在单个 API 调用发出的所有存储请求中跟踪的。例如,如果您在客户端中配置了重试,则在每次可能的重试之前都会检查此值,如果自第一个请求开始以来已经超过 'maximumExecutionTimeInMs',则不会继续重试。

希望这是有道理的。

带有超时选项的示例调用是:

var options = { maximumExecutionTimeInMs: 1000 };
blobSvc.createBlockBlobFromLocalFile('mycontainer', 'myblob', 'test.txt', options, function(error, result, response) {
  if(!error) { 
    // file uploaded 
  } 
});

您可能还想在以下网址查看 API 及其选项:http://azure.github.io/azure-storage-node/BlobService.html