mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 676f9ec451
Co-authored-by: joeykrug <5925937+joeykrug@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
17 lines
471 B
TypeScript
17 lines
471 B
TypeScript
/**
|
|
* Returns an iteration hook for in-process restart loops.
|
|
* The first call is considered initial startup and does nothing.
|
|
* Each subsequent call represents a restart iteration and invokes `onRestart`.
|
|
*/
|
|
export function createRestartIterationHook(onRestart: () => void): () => boolean {
|
|
let isFirstIteration = true;
|
|
return () => {
|
|
if (isFirstIteration) {
|
|
isFirstIteration = false;
|
|
return false;
|
|
}
|
|
onRestart();
|
|
return true;
|
|
};
|
|
}
|