Git Product home page Git Product logo

Comments (7)

rmcdaniel avatar rmcdaniel commented on May 20, 2024 1

@phuclh I have figured out the issue. A fix is coming soon. However you can do this part...

->finally(function () use ($id) {
    $workflow = StoredWorkflow::find($id);
    WorkflowStub::fromStoredWorkflow($workflow)->setReady(true);
})

like this instead...

->finally(function () use ($id) {
    WorkflowStub::load($id)->setReady(true);
})

And it will be simpler for you.

from laravel-workflow.

phuclh avatar phuclh commented on May 20, 2024 1

Nice, thank you for the simpler solution. Have you had a chance to look at the issue when serialization is broken when using Batch with Workflow? Right now, I have to override the serialize, and unserialize methods in DatabaseBatchRepository class to make it works.

protected function serialize($value): string
{
    return Y::serialize($value);
}

protected function unserialize($serialized): mixed
{
    return Y::unserialize($serialized);
}

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024 1

@phuclh Yes sir, I figured it out. I have a PR coming to fix it in the next release. 🎉

from laravel-workflow.

tuktukvlad avatar tuktukvlad commented on May 20, 2024

Hi
Since batch callbacks are serialized and executed at a later time by the Laravel queue, you should not use the $this variable within the callbacks:
->finally(function () { $this->storedWorkflow->toWorkflow()->setReady(true); })

from laravel-workflow.

phuclh avatar phuclh commented on May 20, 2024

Hi Since batch callbacks are serialized and executed at a later time by the Laravel queue, you should not use the $this variable within the callbacks: ->finally(function () { $this->storedWorkflow->toWorkflow()->setReady(true); })

Yes, I already used WorkflowStub::fromStoredWorkflow() to fix that.

However, do you know why the serialization is broken when using Batch with Workflow? Right now, I have to override the serialize, and unserialize method in DatabaseBatchRepository to make it works.

protected function serialize($value): string
{
    return Y::serialize($value);
}

protected function unserialize($serialized): mixed
{
    return Y::unserialize($serialized);
}

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

It sounds like you found a workaround. Is this still a blocker for you?

from laravel-workflow.

phuclh avatar phuclh commented on May 20, 2024

Great. Thank you so much 👍😊

from laravel-workflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.