Node.js /使用npm包两次

时间:2015-03-20 01:46:10

标签: node.js amazon-s3 npm

我使用s3 npm包将文件上传到S3。

为了推迟上传文件到S3的延迟,我想创建两个线程池:一个将处理大于650 MB的文件,另一个将处理所有小于或等于650 MB的文件。 / p>

这是我的代码:

var s3 = require('s3');
var client = s3.createClient({
            maxAsyncS3: 20, // this is the default
            s3RetryCount: 3, // this is the default
            s3RetryDelay: 1000, // this is the default
            multipartUploadThreshold: 209715200, // this is the default (20 MB)
            multipartUploadSize: 209715200, // this is the default (15 MB)
...

      var clientBig = s3.createClient({
            maxAsyncS3: 25,
            s3RetryCount: 3, // this is the default
            s3RetryDelay: 1000, // this is the default
            multipartUploadThreshold: 209715200, // this is the default (20 MB)
            multipartUploadSize: 209715200, // this is the default (15 MB)

在功能上传中,我从fs.stat获取统计信息:

            if (stats != undefined && stats.size != undefined && stats.size > 650000000)
                    uploader = clientBig.uploadFile(params);
            else
                    uploader = client.uploadFile(params);
            //Upload file process..

问题是,当我获得大于7GB的文件时,我看到所有与S3的连接都被占用(因为maxAsyncS3定义),而小于650MB的文件仍在等待空闲连接,甚至认为它在其他包中(并且拥有自己的maxAsyncS3定义)

0 个答案:

没有答案
相关问题