This topic was automatically generated from Slack. You can find the original thread here.
Is it just me or is $.flow.rerun()
now supported in the builder?!?
This topic was automatically generated from Slack. You can find the original thread here.
Is it just me or is $.flow.rerun()
now supported in the builder?!?
Previously, it would say something like āWorkflow would have pausedā.
But now it actually seems to run and receive callbacks at the resume_url
!
Itās a nice & welcome surprise!
, @U02SX7ETBFB: I ran into a weird issue though, because when the resume_url
was called by a webhook/callback, it resumed the workflow three times. I know because I received three Slack notifications that the workflow had competed.
Not a big deal since itās just the builder, but probably something to fix eventually.
Thanks for reporting! Iāll test this ASAP
It might be an edge caseā¦ let me know if you need help reproducing.
Iām trying to repro in the builder but the only consistent result Iām getting is that whenever $.flow.rerun()
is called it never ends the step testing (though the code itself is executed)
E.g.
export default defineComponent({
props: {
data_store: {
type: "data_store"
}
},
async run({ steps, $ }) {
let count = await this.data_store.get("count") || 0
if (count > 0) {
console.log("done")
await this.data_store.set("count", 0)
} else {
console.log("Hi!")
await this.data_store.set("count", count + 1)
$.flow.rerun(5000, null, 1)
}
},
})
I test once and the $.flow.rerun(5000, null, 1)
is called, the data_store count
is set to 1 but the step never finishes
If I cancel the testing and test again, it logs on console.log("done")
Iāve tried $.export("rerun", $.flow.rerun(5000, null, 1))
but it shows only in a deployed execution
I donāt think the suspend/resume functionality is working in the builder yet.
See this thread.
But if you call the resume_url
by hand (you can just console.log()
it), it should resume the workflow (possibly more than once).
Oh, so youāre talking about on a deployed workflow or on the builder?
Iām trying to get it to resume more than once, but am not successful
On the builder.
Once deployed, everything works normally.
Iāll try to reproduce it again.
Ah, console.log()
doesnāt work to get the resume_url
:man-facepalming:
Iāll put it into the data store instead. :man-shrugging:
Just tried with this simple code:
export default defineComponent({
props: {
ds: {
type: "data_store"
}
},
async run({ steps, $ }) {
if ($.context.run.runs === 1) {
await this.ds.set(
'test_rerun',
$.flow.rerun(5000, null, 1)
);
} else {
console.log('resumed');
await this.ds.set(Math.random().toString(36), Date.now());
}
},
})
And I couldnāt reproduce it at first, until I realized that our callback workflow calls the resume_url
multiple times (to handle cases when the resume fails silently).