-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context.cancel & rename errors & lazy fetch #8
Conversation
initial payload is still accessible through context.initialPayload
run state would become run_success. now it becomes run_canceled
src/client/utils.ts
Outdated
@@ -25,3 +26,24 @@ export const makeGetWaitersRequest = async ( | |||
})) as Required<Waiter>[]; | |||
return result; | |||
}; | |||
|
|||
export const makeCancelRequest = async (requester: Client["http"], workflowRunId: string) => { | |||
const result = (await requester.request({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does /v2/workflows/runs/ID
retturns empty response on successfull cancellation? Don't we get any response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it returns empty response.
src/context/context.ts
Outdated
@@ -383,6 +387,20 @@ export class WorkflowContext<TInitialPayload = unknown> { | |||
} | |||
} | |||
|
|||
/** | |||
* Notify waiting workflow runs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this explanation should tell a bit more than the function signature itself. Since this is not trivial, can we give more explanation?
74ce6be
to
14dce13
Compare
@@ -3,4 +3,4 @@ export * from "./context"; | |||
export * from "./types"; | |||
export * from "./logger"; | |||
export * from "./client"; | |||
export { QStashWorkflowError, QStashWorkflowAbort } from "./error"; | |||
export { WorkflowError, WorkflowAbort } from "./error"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we make a major release? If not maybe we should do something like this for consistency
export const QStashWorkflowError = WorkflowError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be a major release.
currently it's 0.1.2, this will be 0.2.0
There are some conflicts @CahidArda |
3dae122
to
87b6eb8
Compare
conflicts fixed. @fahreddinozcan |
lazy fetch will be updated with https://github.com/upstash/qstash-server/pull/423 |
cdd7fd5
to
65015c6
Compare
they are disabled because they are unreliable in CI. will run locally instead.
ce636b9
to
c91cf2b
Compare
context.cancel
added method for canceling a worklfow with its context:
workflow status will appear as
RUN_CANCELED
in Upstash Console.rename errors
renamed errors from QStashWorkflowAbort and QStashWorkflowError to WorkflowAbort and WorkflowError
lazy fetch
adds the lazy fetch feature.
There is one case we can't handle right now: lazy fetch doesn't work with failureFunction. Lazy fetch doesn't become enabled. So the payload is delivered as it is. This means that your workflow can grow larger than 10Mb thanks to lazy fetch, but failureFunction won't work if this happens.edit: this issue was addressed in this PR.