-
Notifications
You must be signed in to change notification settings - Fork 17
[Backend] Reduce resultMap sync frequency #489
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
Conversation
apps/yjs/src/yjs-runtime.ts
Outdated
let podId = payload["podId"] || undefined; | ||
if (podId) { | ||
const oldresult: PodResult = resultMap.get(podId) || { data: [] }; | ||
if (oldresult.last_exec_end) { |
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 last_exec_end
is unnecessary, and I intend to remove it. I was not setting it on purpose.
It was only used to clear the results. The result is now (better) cleared on the frontend right before executing the pod (code).
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.
SG, I missed the code here. Let me clean up the code.
apps/yjs/src/yjs-runtime.ts
Outdated
@@ -78,7 +77,6 @@ export async function setupRuntimeSocket({ | |||
type: `${type}_${content.name}`, | |||
text: content.text, | |||
}); | |||
resultMap.set(podId, oldresult); |
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.
Is this unnecessary?
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 is necessary. Otherwise the stream won't be displayed until the very end. Try this:
import time
for i in range(5):
print(i)
time.sleep(1)
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 noticed the yjs sync resultMap
at least 3 times during a single run
, and intended to reduce the frequency. But from the example above, I agree that yjs should honer the kernel execution behavior even though the sync cost is high. Let me revert the change.
Thanks! |
Summary
resultMap.set()
methodresultPod. lastExecutedAt
value is missing after execution. #483; very interesting solution from ChatGPT, while I didn't find its sourcesTest