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

adding created() event to IsolateObserver #90

Merged
merged 1 commit into from Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/workerd/io/observer.h
Expand Up @@ -74,6 +74,9 @@ class RequestObserver: public kj::Refcounted {

class IsolateObserver: public kj::AtomicRefcounted {
public:
virtual void created(kj::StringPtr id) {};
// Called when Worker::Isolate is created.

virtual void evicted() {}
// Called when the owning Worker::Script is being destroyed. The IsolateObserver may
// live a while longer to handle deferred proxy requests.
Expand Down
1 change: 1 addition & 0 deletions src/workerd/io/worker.c++
Expand Up @@ -977,6 +977,7 @@ Worker::Isolate::Isolate(kj::Own<ApiIsolate> apiIsolateParam,
metrics(kj::mv(metricsParam)),
impl(kj::heap<Impl>(*apiIsolate, *metrics, *limitEnforcer, allowInspector)),
weakIsolateRef(kj::atomicRefcounted<WeakIsolateRef>(this)) {
metrics->created(id);
// We just created our isolate, so we don't need to use Isolate::Impl::Lock (nor an async lock).
auto lock = apiIsolate->lock();
auto features = apiIsolate->getFeatureFlags();
Expand Down