You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by "empiredan (via GitHub)" <gi...@apache.org> on 2023/02/15 04:17:02 UTC

[GitHub] [incubator-pegasus] empiredan commented on a diff in pull request #1352: refactor(conf): use DSN_DEFINE_uint32 to load uint32 type of configs

empiredan commented on code in PR #1352:
URL: https://github.com/apache/incubator-pegasus/pull/1352#discussion_r1106603448


##########
src/meta/test/main.cpp:
##########
@@ -80,13 +82,11 @@ TEST(meta, app_envs_basic_test) { g_app->app_envs_basic_test(); }
 
 dsn::error_code meta_service_test_app::start(const std::vector<std::string> &args)
 {
-    uint32_t seed =
-        (uint32_t)dsn_config_get_value_uint64("tools.simulator", "random_seed", 0, "random seed");
-    if (seed == 0) {
-        seed = time(0);
-        LOG_ERROR("initial seed: {}", seed);
+    if (FLAGS_random_seed == 0) {
+        FLAGS_random_seed = time(0);
+        LOG_ERROR("initial seed: {}", FLAGS_random_seed);

Review Comment:
   ```suggestion
           FLAGS_random_seed = static_cast<uint32_t>(time(nullptr));
           LOG_INFO("initial seed: {}", FLAGS_random_seed);
   ```



##########
src/runtime/rpc/rpc_message.cpp:
##########
@@ -32,13 +32,20 @@
 #include <cctype>
 
 #include "runtime/task/task_engine.h"
+#include "utils/flags.h"
 
 using namespace dsn::utils;
 
 namespace dsn {
+// init common for all per-node providers
+DSN_DEFINE_uint32(core,
+                  local_hash,
+                  0,
+                  "a same hash value from two processes indicate the rpc code are registered in "

Review Comment:
   ```suggestion
                     "a same hash value from two processes indicate the rpc codes are registered in "
   ```



##########
src/runtime/rpc/network.sim.cpp:
##########
@@ -194,8 +187,8 @@ error_code sim_network_provider::start(rpc_channel channel, int port, bool clien
 
 uint32_t sim_network_provider::net_delay_milliseconds() const
 {
-    return static_cast<uint32_t>(
-               rand::next_u32(_min_message_delay_microseconds, _max_message_delay_microseconds)) /
+    return static_cast<uint32_t>(rand::next_u32(FLAGS_min_message_delay_microseconds,
+                                                FLAGS_max_message_delay_microseconds)) /

Review Comment:
   ```suggestion
       return rand::next_u32(FLAGS_min_message_delay_microseconds,
                             FLAGS_max_message_delay_microseconds) /
   ```



-- 
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: dev-unsubscribe@pegasus.apache.org

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