Giter Site home page Giter Site logo

Comments (1)

WhataHeckinName avatar WhataHeckinName commented on August 17, 2024

I've encountered this as well but I've discovered more information when testing with the basic "Hello" activity template. Instead of yielding to an array, I changed it to yield to it's own variable.

const activityName = "DurableFunctionsHelloActivity";
const orchestratorName = "DurableFunctionsOrchestrator";

export const durableFunctionsOrchestrator: OrchestrationHandler = function* (context: OrchestrationContext) {
    logIfNotReplaying(context, `Received request to orchestrator ${orchestratorName}`);

    const output1 = yield context.df.callActivity(activityName, "Tokyo"); // line 7
    const output2 = yield context.df.callActivity(activityName, "Seattle"); // line 8
    const output3 = yield context.df.callActivity(activityName, "Cairo"); // line 9

    logIfNotReplaying(context, `Processed orchestrator with outputs ${output1} ${output2} ${output3}`);

    return [output1, output2, output3];
};

const logIfNotReplaying = (context: OrchestrationContext, message: string): void => {
    const isReplayString = context.triggerMetadata.isReplaying as string;
    if (isReplayString == 'False') {
        context.log(message);
    }
};

df.app.orchestration(orchestratorName, durableFunctionsOrchestrator);

context.triggerMetadata.isReplaying is 'False' until after the first callActivity and then for the rest of the orchestrator's life (line 8 and on) it is set to 'True' regardless of whether it has handled the next activity yet or not. So this is not a reliable replacement.

context.df.isReplaying is undefined until after a callActivity processes. So put a break point on line 8. First time that break point is hit, it changes to false. After the 2nd time it hits the break point (meaning 2nd callActivity processed and intends to go to the 3rd callActivity) then it changes to true but only during the breakpoint on line 8. A second break point on line 9 would show the value immediately go back to false.

So there's definitely a bug to this context.df.isReplaying value. I've confirmed this with durable-functions version 3.0.0 and latest.

from azure-functions-durable-js.

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.