gavinchou commented on code in PR #37663:
URL: https://github.com/apache/doris/pull/37663#discussion_r1677035120

##########
common/cpp/s3_rate_limiter.cpp:
##########
@@ -17,22 +17,49 @@
 
 #include "s3_rate_limiter.h"
 
-#include <fmt/format.h>
-
 #include <chrono>
+#include <mutex>
 #include <thread>
 
-namespace doris::cloud {
+namespace doris {
 // Just 10^6.
 static constexpr auto MS = 1000000UL;
 
+class S3RateLimiter::SimpleSpinLock {
+public:
+    SimpleSpinLock() = default;
+    ~SimpleSpinLock() = default;
+
+    void lock() {
+        while (_flag.test_and_set(std::memory_order_acq_rel)) {
+            // Spin until we acquire the lock

Review Comment:
   Log if too many times tried?



##########
common/cpp/s3_rate_limiter.cpp:
##########


Review Comment:
   Are there any tests for rate limiter?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to