在允许它完成后取消 CronSchedule 工作流

问题描述

如果我有一个工作流,其中 Cronschedule 指定了多个活动,有没有办法仅在工作流中的所有活动都已执行后取消/终止它。我也不希望它再具有 ContinueAsNew 状态。

解决方法

最好的方法是取消 self 作为工作流程的最后一步。 您可以使用 Activity 调用 Cadence API

import React from "react";
import { Text } from "react-native";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import { persistor,store } from "./store";
import { TextInputSetting } from "./TextInputSetting";

export default function App() {
  return (
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <>
          <Text style={{ fontSize: 50,textAlign: "center",paddingTop: 200 }}>
            Hi there
          </Text>
          <TextInputSetting
            label="First Field"
            settingKey="set1"
            boxWidth={200}
          />
          <TextInputSetting
            label="Second Field"
            settingKey="set2"
            boxWidth={200}
          />
        </>
      </PersistGate>
    </Provider>
  );
}

或使用 RequestCancel 功能。

CancelWorkflow(ctx context.Context,workflowID string,runID string) error

它被称为 func RequestCancelExternalWorkflow(ctx Context,workflowID,runID string) Future { 但如果你把 self workflowID,它也应该工作。