Code Monkey home page Code Monkey logo

Comments (4)

sfmskywalker avatar sfmskywalker commented on June 27, 2024 1

Thanks @edward-yuen-tfs for the level of detail + working repro - I can indeed reproduce the issue.

from elsa-core.

sfmskywalker avatar sfmskywalker commented on June 27, 2024 1

Confirmed on all points 👍🏻

from elsa-core.

sfmskywalker avatar sfmskywalker commented on June 27, 2024

I figured out what the problem is. Actually, there are two issues:

1. Variable Persistence

Notice the following line in your workflow:

image

When using builder.WithVariable(), it will create a variable on the workflow level.
But when you assign a variable with the same name on a child activity, such as Sequence in your workflow, that variable becomes closer to your custom activity, which means that your custom activity will be setting the variable's value in the scope of the Sequence activity and not in the scope of the workflow.

That on its own wouldn't be a big deal, if it weren't for the fact that as of this writing, only workflow-level variables are persisted.

Given that the workflow level variable is never updated, it explains that its value is lost after resuming the workflow instance.

So, if you remove that line that I enrectangled red in the screenshot, it will work - almost.

2. Variable Scoping Bug

While troubleshooting this issue, I encountered a bug that causes your workflow to print the same number twice (the number 4, as you will see).
This is due to a scoping inconsistency bug in Elsa. I am already working on a fix that I will push out over the weekend, which means that you'll be able to take advantage by referencing the preview packages once they are built.

I'll update progress here soon.

from elsa-core.

edward-yuen-tfs avatar edward-yuen-tfs commented on June 27, 2024

Thank you for looking into that. Just want to be confirm on this.

  1. "only workflow-level variables are persisted." - that means
    a. activity level variables are not persisted.
    b. For the picture below, which I have commented out the line you suggest.
    image
  • As I already set the value in the orange box, I do not need to set the value in the red box. Both lines in fact refer to the same scope.
  • I do not need the commented line as it shall be considered as defining a new variable within the sequence scope. It is not considered as passing the workflow scope variable to the sequence scope (it is not needed.)
    c. After I commented the line, CustomActivity is actually setting the variable value to the workflow scope.

Just want to confirm if my understanding is correct.

from elsa-core.

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.