-
Notifications
You must be signed in to change notification settings - Fork 150
feat(rivetkit): add run #4002
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
base: graphite-base/4002
Are you sure you want to change the base?
feat(rivetkit): add run #4002
Conversation
|
🚅 Deployed to the rivet-pr-4002 environment in rivet-frontend
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR Review: Add
|
| #startRunHandler() { | ||
| if (!this.#config.run) return; | ||
|
|
||
| this.#rLog.debug({ msg: "starting run handler" }); | ||
|
|
||
| const runResult = this.#config.run(this.actorContext); | ||
|
|
||
| if (runResult instanceof Promise) { | ||
| this.#runPromise = runResult | ||
| .then(() => { | ||
| // Run handler exited normally - this should crash the actor | ||
| this.#rLog.warn({ | ||
| msg: "run handler exited unexpectedly, crashing actor to reschedule", | ||
| }); | ||
| this.startDestroy(); | ||
| }) | ||
| .catch((error) => { | ||
| // Run handler threw an error - crash the actor | ||
| this.#rLog.error({ | ||
| msg: "run handler threw error, crashing actor to reschedule", | ||
| error: stringifyError(error), | ||
| }); | ||
| this.startDestroy(); | ||
| }); | ||
| } | ||
| } |
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.
The run handler only crashes the actor if it returns a Promise. If the run handler is synchronous (returns void), it exits immediately without crashing the actor, which violates the documented behavior.
According to the documentation and comments, if the run handler exits (returns), the actor should crash and reschedule. However, the current code only handles the Promise case.
Fix:
#startRunHandler() {
if (!this.#config.run) return;
this.#rLog.debug({ msg: "starting run handler" });
const runResult = this.#config.run(this.actorContext);
if (runResult instanceof Promise) {
this.#runPromise = runResult
.then(() => {
this.#rLog.warn({
msg: "run handler exited unexpectedly, crashing actor to reschedule",
});
this.startDestroy();
})
.catch((error) => {
this.#rLog.error({
msg: "run handler threw error, crashing actor to reschedule",
error: stringifyError(error),
});
this.startDestroy();
});
} else {
// Synchronous return - crash immediately
this.#rLog.warn({
msg: "run handler exited unexpectedly (synchronous), crashing actor to reschedule",
});
this.startDestroy();
}
}| #startRunHandler() { | |
| if (!this.#config.run) return; | |
| this.#rLog.debug({ msg: "starting run handler" }); | |
| const runResult = this.#config.run(this.actorContext); | |
| if (runResult instanceof Promise) { | |
| this.#runPromise = runResult | |
| .then(() => { | |
| // Run handler exited normally - this should crash the actor | |
| this.#rLog.warn({ | |
| msg: "run handler exited unexpectedly, crashing actor to reschedule", | |
| }); | |
| this.startDestroy(); | |
| }) | |
| .catch((error) => { | |
| // Run handler threw an error - crash the actor | |
| this.#rLog.error({ | |
| msg: "run handler threw error, crashing actor to reschedule", | |
| error: stringifyError(error), | |
| }); | |
| this.startDestroy(); | |
| }); | |
| } | |
| } | |
| #startRunHandler() { | |
| if (!this.#config.run) return; | |
| this.#rLog.debug({ msg: "starting run handler" }); | |
| const runResult = this.#config.run(this.actorContext); | |
| if (runResult instanceof Promise) { | |
| this.#runPromise = runResult | |
| .then(() => { | |
| // Run handler exited normally - this should crash the actor | |
| this.#rLog.warn({ | |
| msg: "run handler exited unexpectedly, crashing actor to reschedule", | |
| }); | |
| this.startDestroy(); | |
| }) | |
| .catch((error) => { | |
| // Run handler threw an error - crash the actor | |
| this.#rLog.error({ | |
| msg: "run handler threw error, crashing actor to reschedule", | |
| error: stringifyError(error), | |
| }); | |
| this.startDestroy(); | |
| }); | |
| } else { | |
| // Synchronous return - crash immediately | |
| this.#rLog.warn({ | |
| msg: "run handler exited unexpectedly (synchronous), crashing actor to reschedule", | |
| }); | |
| this.startDestroy(); | |
| } | |
| } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
ead7932 to
f2c24e3
Compare
11d2f22 to
1e5f0e0
Compare

No description provided.