Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add method to unset actor request ref tracker #555

Merged
merged 1 commit into from
Apr 21, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {
MellowYarker marked this conversation as resolved.
Show resolved Hide resolved
// 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