ScriptFUSION / Porter

:lipstick: Durable and asynchronous data imports for consuming data at scale and publishing testable SDKs.
GNU Lesser General Public License v3.0
611 stars 24 forks source link

[BC-BREAK] scriptfusion/retry 1.1.2 #55

Closed samvdb closed 6 years ago

samvdb commented 6 years ago

Hi,

When running porter 3.* retry 1.1.2 will be installed because of the following composer requirement:

"scriptfusion/retry": "^1.1",

The retry lib works on 1.1.1 with porter, upgrading to 1.1.2 breaks stuff.

Specific lines in the retry lib that are triggered:

if ($result instanceof \Generator) {
            throw new \UnexpectedValueException('Cannot retry a Generator. You probably meant something else.');
        }

Porter causes this because a generator is returned in Porter.php line 98

function () use ($provider, $resource) {
                if (($records = $provider->fetch($resource)) instanceof \Iterator) {
                    // Force generator to run until first yield to provoke an exception.
                    $records->valid();
                }

                return $records;     <----- this breaks
            },
Bilge commented 6 years ago

I guess you mean Retry 1.2.0?

Bilge commented 6 years ago

Thanks, @samvdb. I've looked into this and it seems you're correct. That's my fault: I should have bumped the version number for Retry to 2.0.0, not 1.2.0. I'll try deleting the 1.2.0 tag and retagging as 2.0.0 for you.

Keep in mind that the exception message is correct: you cannot retry a generator. This was a design flaw in Porter 3 that is fixed in v4. I hope you will be able to upgrade to v4 and enjoy its improved architecture and fixes soon!