->wait()
on that if you need to block until the upload is complete
->uploadAsync()
method, nothing was getting uploaded. I had a separate timer instead of calling wait, but checked on the value returned by the promise ->then()
method, and also checking S3 directly, the file never uploaded
$s3 = new \Aws\S3\S3Client([
'region' => 'us-west-2',
'version' => 'latest',
'debug' => true,
]);
$uploads = [
'small' => $s3->uploadAsync(
'testing-testing-testing',
'small-file-async-upload',
fopen(__FILE__, 'r')
),
'large' => $s3->uploadAsync(
'testing-testing-testing',
'large-file-async-upload',
fopen(__DIR__ . '/phparchitect-2015-06.pdf' , 'r'),
'private',
[
'before_upload' => function (\Aws\CommandInterface $command) {
echo "uploading chunk {$command['PartNumber']}\n";
}
]
)
];
echo "uploading\n";
\GuzzleHttp\Promise\queue()->run();
\GuzzleHttp\Promise\queue()->run()
finishes
->then
need some prompting
->wait
, which will unwind a full promise stack