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.
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
Merge activity
|
|
Closing as duplicate - the run feature has already been implemented in the main branch. |

No description provided.