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

Merged
merged 2 commits into from
Dec 7, 2024

Conversation

danlapid
Copy link
Collaborator

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
Collaborator 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
Collaborator 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.

@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.

@danlapid danlapid force-pushed the dlapid/refactor_limitenforcer_workerobserver branch from d7ad08e to a35812d Compare November 29, 2024 12:37
@danlapid danlapid force-pushed the dlapid/refactor_limitenforcer_workerobserver branch 2 times, most recently from f3d3fb4 to 91c0568 Compare December 3, 2024 10:32
src/workerd/io/worker.c++ Show resolved Hide resolved
src/workerd/io/worker.h Show resolved Hide resolved
@danlapid danlapid force-pushed the dlapid/refactor_limitenforcer_workerobserver branch 2 times, most recently from c9a3d5c to 9a5a6ee Compare December 7, 2024 00:58
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 9a5a6ee to 550e085 Compare December 7, 2024 11:48
@danlapid danlapid merged commit f979ca7 into main Dec 7, 2024
15 checks passed
@danlapid danlapid deleted the dlapid/refactor_limitenforcer_workerobserver branch December 7, 2024 12:25
danlapid added a commit that referenced this pull request Dec 7, 2024
…r_workerobserver

Refactor Observer and LimitEnforcer cleaner for...
danlapid added a commit that referenced this pull request Dec 7, 2024
…r_workerobserver

Refactor Observer and LimitEnforcer cleaner for...
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.

3 participants