You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2020/10/20 07:52:34 UTC

[GitHub] [incubator-pegasus] acelyc111 commented on a change in pull request #625: feat(hotkey): collector can be terminated by timeout

acelyc111 commented on a change in pull request #625:
URL: https://github.com/apache/incubator-pegasus/pull/625#discussion_r508283660



##########
File path: src/server/hotkey_collector.h
##########
@@ -79,9 +79,13 @@ class hotkey_collector : public dsn::replication::replica_base
 private:
     void on_start_detect(dsn::replication::detect_hotkey_response &resp);
     void on_stop_detect(dsn::replication::detect_hotkey_response &resp);
+    void terminate_colletor();
+    void terminate_by_timeout();

Review comment:
       How about rename to `check_timeout` ?

##########
File path: src/server/hotkey_collector.cpp
##########
@@ -105,13 +117,30 @@ void hotkey_collector::on_start_detect(dsn::replication::detect_hotkey_response
 
 void hotkey_collector::on_stop_detect(dsn::replication::detect_hotkey_response &resp)
 {
-    _state.store(hotkey_collector_state::STOPPED);
-    _internal_collector.reset();
+    terminate_colletor();
     resp.err = dsn::ERR_OK;
     std::string hint =
         fmt::format("{} hotkey stopped, cache cleared", dsn::enum_to_string(_hotkey_type));
     ddebug_replica(hint);
 }
 
+void hotkey_collector::terminate_colletor()
+{
+    _state.store(hotkey_collector_state::STOPPED);
+    _internal_collector.reset();
+    _collector_start_time = 0;
+}
+
+void hotkey_collector::terminate_by_timeout()
+{
+    if (dsn_now_s() == 0)

Review comment:
       How can it happen?




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org