-
Notifications
You must be signed in to change notification settings - Fork 172
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
Cherrypick gc features from stable-gluegunfw #537
Conversation
By the way, without callbacks there is no good way to write tests for this feature. I will add them at some point if/when they are merged as well. |
Alright, master is ready for this PR now, I also merged the GC threshold getter API. If you rebase and get the build green we are good to go! |
In theory it is ok. |
src/js/core/index.js
Outdated
run: () => core._gc.run(), | ||
|
||
set enabled(value) { | ||
if (value === true) { |
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.
if (value === true) { | |
if (value) { |
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.
No need to be that strict.
src/js/core/index.js
Outdated
if (_gc_state.enabled) { | ||
core._gc.setThreshold(value); _gc_state.threshold = value; | ||
} else { | ||
core._gc.setThreshold(-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.
Shouldn't we store the threshold and apply it if the user then flips the enabled switch? Otherwise it will be lost.
You can make the linter happy by running the formatter yourself: npm run format Codegen relies on the node version, make sure you are using 20. I can take care of those myself if you can't. |
I fixed the logic since it was all a bit wonky.
I don't have a node 20 instance on this machine, if you could do that it would be better. |
Ah I meant |
Not really, but it is the usual culprit |
Restricted version of #520, waiting for upstream support of the threshold getter.
I will keep it as draft up to when the quickjs submodule is updated to a commit supporting the getter.