Skip to content
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

Refactor Observer and LimitEnforcer cleaner for... #3114

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danlapid
Copy link
Contributor

isolate pools

@danlapid danlapid force-pushed the dlapid/refactor_limitenforcer_workerobserver branch 2 times, most recently from 8a34223 to b026443 Compare November 14, 2024 14:51
src/workerd/io/worker.c++ Outdated Show resolved Hide resolved
src/workerd/io/worker.h Outdated Show resolved Hide resolved
@danlapid danlapid force-pushed the dlapid/refactor_limitenforcer_workerobserver branch 2 times, most recently from 9349b16 to f5bc217 Compare November 14, 2024 19:41
@danlapid danlapid marked this pull request as ready for review November 14, 2024 20:35
@danlapid danlapid requested review from a team as code owners November 14, 2024 20:35
@danlapid
Copy link
Contributor Author

More info on internal PR #9192

@danlapid danlapid changed the title [DRAFT] Refactor Observer and LimitEnforcer cleaner for... Refactor Observer and LimitEnforcer cleaner for... Nov 14, 2024
@danlapid
Copy link
Contributor Author

Much of this is basically a revert of #3034 for an even cleaner implementation.
Previously ownership was shared by WorkerdApi and Worker::Isolate. Then I made WorkerdApi the owner but that has it's own limitations.
This PR separates the parts of IsolateObserver and LimitEnforcer that each of WorkerdApi and Worker::Isolate own to their own separate classes in a way that allows each of them to own it's own part.

This will return ownership over limitEnforcer from the api class to the
isolate class.
This will allow for better separation of responsibilities between the two.
@danlapid danlapid force-pushed the dlapid/refactor_limitenforcer_workerobserver branch from f5bc217 to d7ad08e Compare November 20, 2024 12:57
@@ -305,11 +307,11 @@ class Worker::Isolate: public kj::AtomicRefcounted {
kj::Maybe<ValidationErrorReporter&> errorReporter = kj::none) const;

inline IsolateLimitEnforcer& getLimitEnforcer() {
return limitEnforcer;
return *limitEnforcer;
}

inline const IsolateLimitEnforcer& getLimitEnforcer() const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking nit: We have the kj::Rc<T> and kj::Arc<T> types now for safer handling of references to refcounted and atomic refcounted types. It would be nice if we could start working on replacing uses of bare references for these where it's not too cumbersome of a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants