Skip to content

Commit

Permalink
avoid bumping shared_ptr refcount in collectRequestDebugLog
Browse files Browse the repository at this point in the history
Reviewed By: praihan

Differential Revision: D30946132

fbshipit-source-id: e0f7f131085442e5ef742c58ae9c2553b383ae10
  • Loading branch information
mshneer authored and facebook-github-bot committed Sep 15, 2021
1 parent d3292d2 commit 9053597
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions thrift/lib/cpp2/server/RequestDebugLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void appendRequestDebugLog(const std::string& msg) {
}

std::vector<std::string> collectRequestDebugLog(
std::shared_ptr<folly::RequestContext> rctx) {
const std::shared_ptr<folly::RequestContext>& rctx) {
DCHECK(rctx.get() != nullptr);
auto log = dynamic_cast<RequestDebugLog*>(rctx->getContextData(getToken()));
if (log == nullptr) {
Expand All @@ -117,7 +117,7 @@ std::vector<std::string> collectRequestDebugLog(
if (rctx == nullptr) {
return {};
}
return collectRequestDebugLog(std::move(rctx));
return collectRequestDebugLog(rctx);
}

} // namespace thrift
Expand Down
2 changes: 1 addition & 1 deletion thrift/lib/cpp2/server/RequestDebugLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace thrift {
void appendRequestDebugLog(std::string&&);
void appendRequestDebugLog(const std::string&);
std::vector<std::string> collectRequestDebugLog(
std::shared_ptr<folly::RequestContext>);
const std::shared_ptr<folly::RequestContext>&);
std::vector<std::string> collectRequestDebugLog(
const RequestsRegistry::DebugStub&);

Expand Down

0 comments on commit 9053597

Please sign in to comment.