Skip to content

Commit

Permalink
Add method to unset actor request ref tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
MellowYarker committed Apr 21, 2023
1 parent 58930e1 commit 2d0c3d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/workerd/io/request-tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class RequestTracker {

public:
ActiveRequest(ActiveRequest&& other) = default;
ActiveRequest& operator=(ActiveRequest&& other) = default;
~ActiveRequest();

private:
Expand Down
7 changes: 5 additions & 2 deletions src/workerd/io/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,11 @@ class Worker::Actor final: public kj::Refcounted {
// Runs an alarm in this actor. This function will handle deduplicating multiple alarms. If this
// isn't a duplicate alarm, func will be called to run the alarm.

void unsetRequestTracker() {
// Unsets the RequestTracker if we're shutting down.
tracker = nullptr;
}

kj::Own<Worker::Actor> addRef() {
KJ_IF_MAYBE(t, tracker) {
return kj::addRef(*this).attach(t->startRequest());
Expand All @@ -745,8 +750,6 @@ class Worker::Actor final: public kj::Refcounted {
}
private:
kj::Own<const Worker> worker;

// TODO(soon): Provide a RequestTracker in workerd so this can no longer be a Maybe
kj::Maybe<RequestTracker&> tracker;
struct Impl;
kj::Own<Impl> impl;
Expand Down

0 comments on commit 2d0c3d9

Please # to comment.