Skip to content

Commit

Permalink
Merge pull request #788 from cloudflare/milan/hibernate-locally
Browse files Browse the repository at this point in the history
Hardcode ws hibernation event type in workerd
  • Loading branch information
MellowYarker authored Jun 20, 2023
2 parents 21ea897 + 0f9f997 commit 3c15df5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/workerd/server/server.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1395,10 +1395,13 @@ public:

auto loopback = kj::refcounted<Loopback>(*this, kj::str(id));
Worker::Lock lock(*service.worker, asyncLock);
// We define this event ID in the internal codebase, but to have WebSocket Hibernation
// work for local development we need to pass an event type.
static constexpr uint16_t hibernationEventTypeId = 8;
auto newActor = kj::refcounted<Worker::Actor>(
*service.worker, nullptr, kj::str(id), true, kj::mv(makeActorCache),
className, kj::mv(makeStorage), lock, kj::mv(loopback),
timerChannel, kj::refcounted<ActorObserver>(), nullptr, nullptr);
timerChannel, kj::refcounted<ActorObserver>(), nullptr, hibernationEventTypeId);

// If the actor becomes broken, remove it from the map, so a new one will be created
// next time.
Expand Down

0 comments on commit 3c15df5

Please sign in to comment.