Skip to content

Commit

Permalink
adding created() event to IsolateObserver (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikea committed Oct 11, 2022
1 parent 988b242 commit 4aa91a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
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

0 comments on commit 4aa91a7

Please sign in to comment.