@@ -179,12 +179,7 @@ jsg::Promise<jsg::JsRef<jsg::JsMap>> KvNamespace::getBulk(jsg::Lock& js,
179179 [client = kj::mv (client), urlStr = kj::mv (urlStr), headers = kj::mv (headers),
180180 expectedBodySize, supportedBody = kj::mv (body)]() mutable {
181181 auto innerReq = client->request (kj::HttpMethod::POST, urlStr, headers, expectedBodySize);
182- struct RefcountedWrapper : public kj ::Refcounted {
183- explicit RefcountedWrapper (kj::Own<kj::HttpClient> client): client(kj::mv(client)) {}
184- kj::Own<kj::HttpClient> client;
185- };
186- auto rcClient = kj::refcounted<RefcountedWrapper>(kj::mv (client));
187- auto req = attachToRequest (kj::mv (innerReq), kj::mv (rcClient));
182+ auto req = attachToRequest (kj::mv (innerReq), kj::refcountedWrapper (kj::mv (client)));
188183
189184 kj::Promise<void > writePromise = nullptr ;
190185 writePromise = req.body ->write (supportedBody.asBytes ()).attach (kj::mv (supportedBody));
@@ -638,13 +633,8 @@ jsg::Promise<void> KvNamespace::put(jsg::Lock& js,
638633 [&context, client = kj::mv (client), urlStr = kj::mv (urlStr), headers = kj::mv (headers),
639634 expectedBodySize, supportedBody = kj::mv (supportedBody)]() mutable {
640635 auto innerReq = client->request (kj::HttpMethod::PUT, urlStr, headers, expectedBodySize);
641- struct RefcountedWrapper : public kj ::Refcounted {
642- explicit RefcountedWrapper (kj::Own<kj::HttpClient> client): client(kj::mv(client)) {}
643- kj::Own<kj::HttpClient> client;
644- };
645- auto rcClient = kj::refcounted<RefcountedWrapper>(kj::mv (client));
646636 // TODO(perf): More efficient to explicitly attach rcClient below?
647- auto req = attachToRequest (kj::mv (innerReq), kj::mv (rcClient ));
637+ auto req = attachToRequest (kj::mv (innerReq), kj::refcountedWrapper ( kj:: mv (client) ));
648638
649639 kj::Promise<void > writePromise = nullptr ;
650640 KJ_SWITCH_ONEOF (supportedBody) {
0 commit comments