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

download 文件 timeout 设置非-1, retry 后即使设置 -1 下载后的文件也不完整 #63

Open
codezm opened this issue Aug 8, 2019 · 0 comments

Comments

@codezm
Copy link

codezm commented Aug 8, 2019

服务环境

  • php
PHP 7.2.20 (cli) (built: Jul 18 2019 16:56:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
  • swoole
swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.3.5
Built => Jul 18 2019 17:49:23
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1b  26 Feb 2019
http2 => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

复现代码

$response = SaberGM::download(
    $url,
    $this->config['download_dir'] . $name,
    0,
    [
        'timeout' => 3,
        'retry_time' => 10,
        'retry' => function (\Swlib\Saber\Request $request, \Swlib\Saber\Response $response) {
            $request->timeout = -1;
            $this->logger("[retry - " . $request->getRetriedTime() . "] " . $request->getUri() . ', response: ' . $response->success . ', req-timeout: ' . $request->getTimeout());
        }
    ]
);
if ($response->success) {
    $this->logger('Download ' . $name . ' file is over...');
}

若文件未超时下载后是完整了,若超时下载后文件不是完整的。

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

No branches or pull requests

2 participants