Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

putObject在第10000次后失效 #52

Closed
78 opened this issue Aug 2, 2018 · 5 comments
Closed

putObject在第10000次后失效 #52

78 opened this issue Aug 2, 2018 · 5 comments

Comments

@78
Copy link

78 commented Aug 2, 2018

这个问题让我们服务炸了三天

Current:

        if (queue.length > cos.options.UploadQueueSize) {
            queue.splice(0, queue.length - cos.options.UploadQueueSize);
        }

Fix:

        if (queue.length > cos.options.UploadQueueSize) {
            const delta = queue.length - cos.options.UploadQueueSize;
            queue.splice(0, delta);
            nextUploadIndex -= delta;
        }
@WizTeam
Copy link

WizTeam commented Oct 11, 2018

同样遇到这个问题。

楼上提供了一个解决办法,但是极端情况下仍然会有问题,例如,我在程序一开始就添加了10000个上传任务(假如此时cos还没有开始上传),然后再添加的时候,就会导致仍然没有上传的任务丢失。

另外,建议腾讯开发人员不要自己实现并发任务,可以直接使用第三方库来实现。https://github.com/caolan/async

@beordle
Copy link
Member

beordle commented Oct 11, 2018

已经联系cos的同学看了

@WizTeam
Copy link

WizTeam commented Oct 12, 2018

这是严重bug,直接会造成生产上面服务直接不可用,尽快修复吧

@carsonxu
Copy link
Collaborator

@WizTeam 已修复问题,试试 npm 更新最新版本 2.4.11
async 不方便处理动态的队列,所以这里是自己实现的并发。

@carsonxu
Copy link
Collaborator

这里队列如果 10000 个不够,可以使用参数 UploadQueueSize 控制

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants