aws-sdk-php-automation on 3.233.2
aws-sdk-php-automation on master
Update models for release 3.233.2 release (compare)
aws-sdk-php-automation on 3.233.1
aws-sdk-php-automation on master
Update models for release 3.233.1 release (compare)
->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
<?php
$uploading = 0;
$AWS = new Aws\Sdk([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => [
'key' => '***',
'secret' => '***',
]
]);
$S3 = $AWS->createS3();
echo "beginning first promise\n";
$uploading ++;
$promise1 = $S3->uploadAsync('tantor-books', 'Test/test.xml', fopen('/mnt/olympus/Books/0087_CoalHuman/Download/0087_CoalHuman.xml', 'r'));
$promise1->then(function() use ($uploading) {
$uploading --;
});
echo "beginning second promise\n";
$uploading ++;
$promise2 = $S3->uploadAsync('tantor-books', 'Test/test.zip', fopen('/mnt/olympus/Books/0087_CoalHuman/Download/0087_CoalHuman.zip', 'r'));
$promise2->then(function() use ($uploading) {
$uploading --;
});
echo "beginning loop\n";
while ($uploading != 0) {
echo 'uploading: '.$uploading."\n";
}
$uploading
value never changes, because the then()
functions aren't firing, because the files never upload. I've also let it run and checked externally to see if the files ever showed up on the S3 bucket, and they didn't, which leads me to believe that the uploadAsync()
method isn't firing when called