Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Multiple file uploads returns uncatchable B2 Exception too busy when fails #26

@PaddyLock

Description

@PaddyLock

I am looping through multiple files and passing to a recursive function to to upload to a B2 bucket like so:

private function upload($client, $file, $fileInfo, $savePath)
    {
        try {
            $client->upload([
                'BucketName' => 'my-bucket-name',
                'FileName' => $file->getId() . '/' . $fileInfo->getFilename(),
                'Body' => fopen($savePath .'/' . $fileInfo->getFilename(), 'r')
            ]);
        } catch (Exception $e) {
            $this->upload($client, $file, $fileInfo, $savePath);
        }
    }

The problem is that with multiple file uploads it is expected behaviour for B2 to occasionally fail. See here for 'Uploading Large Files' and 'Code Structure' - https://www.backblaze.com/b2/docs/uploading.html

The error I get after several successful file uploads looks like this

In ErrorHandler.php line 36: Received error from B2: c002_v0001118_t0038 is too busy

The problem here is firstly that the real error and response code is hidden, and secondly even though I am in a try catch block, it doesn't catch the exception.

My question is how should I handle multiple large file uploads to handle these expected (and other) potential exceptions?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions