Skip to content

Commit de35ffb

Browse files
Oleksandr Yermolenkometa-codesync[bot]
authored andcommitted
Add JK to enable/disable rate limiting based on NIC
Summary: As title, to disable ARL based on NIC quickly, given the nature of counters Reviewed By: kwaugh Differential Revision: D100241433 fbshipit-source-id: 32b076f843cd0382cfadfee2048194114b0ffcd2
1 parent b99ce4c commit de35ffb

File tree

2 files changed

+10
-1
lines changed
  • eden/mononoke/common/adaptive_rate_limiter

2 files changed

+10
-1
lines changed

eden/mononoke/common/adaptive_rate_limiter/BUCK

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ cpp_library(
1212
"src/ffi.h",
1313
],
1414
undefined_symbols = True,
15-
deps = [],
15+
deps = [
16+
"//folly:singleton",
17+
],
1618
exported_deps = [
1719
"//eden/mononoke/common/adaptive_rate_limiter/cpp:adaptive_rate_limiter_cpp",
1820
],

eden/mononoke/common/adaptive_rate_limiter/src/ffi.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@
77

88
#include "eden/mononoke/common/adaptive_rate_limiter/src/ffi.h"
99

10+
#include <folly/Singleton.h>
11+
1012
namespace facebook::mononoke::ffi {
1113

1214
std::unique_ptr<CppAdaptiveRateLimiterWrapper> new_adaptive_rate_limiter(
1315
const CppAdaptiveRateLimiterConfig& config) {
16+
// Ensure folly singletons are initialized. Idempotent — no-op if
17+
// folly::init was already called (e.g., in production revproxy).
18+
// Required for non-folly binaries (Rust tests) where C++ static
19+
// destructors may access singletons like JustKnobs.
20+
folly::SingletonVault::singleton()->registrationComplete();
1421
return std::make_unique<CppAdaptiveRateLimiterWrapper>(config);
1522
}
1623

0 commit comments

Comments
 (0)