-
Notifications
You must be signed in to change notification settings - Fork 115
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
MESDK-87 Add delegate pattern for MessagesQuery<->LintReportQuery communication #2734
Conversation
🦋 Changeset detectedLatest commit: 7986415 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
# Conflicts: # pnpm-lock.yaml
|
||
return { | ||
getAll: async () => { | ||
// TODO reintroduce reactivity here - wont be the bottleneck |
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 wouldn't spend more time on this TODO - let's remove it.
await sleep(0) // evaluate on next tick to allow for out-of-order effects | ||
return structuredClone( | ||
[...index.values()].flat().length === 0 ? [] : [...index.values()].flat() | ||
) | ||
}, | ||
get: async (args: Parameters<MessageLintReportsQueryApi["get"]>[0]) => { | ||
// TODO reintroduce reactivity here |
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.
same - no need to re-introduce reactivity.
@@ -62,6 +62,13 @@ export function createMessagesQuery({ | |||
// filepath for the lock folder | |||
const messageLockDirPath = projectPath + "/messagelock" | |||
|
|||
// TODO check if we should use a weak ref instead |
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'd prefer not to complicate the code with weak refs unless really needed.
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 surprise is that the process dies with an out of memory crash 💥 during a 10k load-test without translation but with watch turned on, which keeps the process alive (pnpm test 10000 0 1 1 1
)
I don't understand why the delegate needs so much more memory when we're no longer creating nested effects.
Once I introduced the sleep-every-500-messages fix from #2738, the process no longer crashes, and total memory usage drops to 380MB which is much better (before it would stay pegged at about 2GB). I was even able to load 20k messages, and then translate them!
I pushed a commit to add the sleep during load.
I also filed opral/inlang-sdk#54 and opral/inlang-sdk#53 for important issues found during the investigation.
See also opral/inlang-sdk#57 |
resolves opral/inlang-sdk#49