]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10038: [core] tune heartbeat events interval
authorRazvan Crainea <razvan@opensips.org>
Tue, 14 Feb 2017 11:41:52 +0000 (13:41 +0200)
committerMike Jerris <mike@jerris.com>
Tue, 7 Mar 2017 19:38:08 +0000 (13:38 -0600)
Conflicts:
src/switch_core.c

conf/vanilla/autoload_configs/switch.conf.xml
src/include/private/switch_core_pvt.h
src/switch_core.c

index 345a16c19e37749a4bb72e935e4ae6cff86c4b0f..ababe548ac447f99245079c7fc929b31a0d86699 100644 (file)
@@ -48,6 +48,9 @@
     <!-- Minimum idle CPU before refusing calls -->
     <!-- <param name="min-idle-cpu" value="25"/> -->
 
+    <!-- Interval between heartbeat events -->
+    <!-- <param name="event-heartbeat-interval" value="20"/> -->
+
     <!--
        Max number of sessions to allow at any given time.
        
index 4204fcd0d5612d646b1c807825857c484595b6c2..7f6b2aa73cee0b66fca0b55e74a96c448ef0e28e 100644 (file)
@@ -290,6 +290,7 @@ struct switch_runtime {
        int multiple_registrations;
        uint32_t max_db_handles;
        uint32_t db_handle_timeout;
+       uint32_t event_heartbeat_interval;
        int cpu_count;
        uint32_t time_sync;
        char *core_db_pre_trans_execute;
index f733464c7fdd9c79864e9490408cabf196a03b19..0a3a4a4042ac7e32b9814ada60a0084291a7a254 100644 (file)
@@ -205,7 +205,7 @@ SWITCH_STANDARD_SCHED_FUNC(heartbeat_callback)
        send_heartbeat();
 
        /* reschedule this task */
-       task->runtime = switch_epoch_time_now(NULL) + 20;
+       task->runtime = switch_epoch_time_now(NULL) + runtime.event_heartbeat_interval;
 }
 
 
@@ -1825,7 +1825,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
 
        runtime.max_db_handles = 50;
        runtime.db_handle_timeout = 5000000;
-       
+       runtime.event_heartbeat_interval = 20;
        runtime.runlevel++;
        runtime.dummy_cng_frame.data = runtime.dummy_data;
        runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
@@ -2138,7 +2138,14 @@ static void switch_load_core_config(const char *file)
                                        } else {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "db-handle-timeout must be between 1 and 5000\n");
                                        }
-                                       
+                               } else if (!strcasecmp(var, "event-heartbeat-interval")) {
+                                       long tmp = atol(val);
+
+                                       if (tmp > 0) {
+                                               runtime.event_heartbeat_interval = (uint32_t) tmp;
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "heartbeat-interval must be a greater than 0\n");
+                                       }
                                } else if (!strcasecmp(var, "multiple-registrations")) {
                                        runtime.multiple_registrations = switch_true(val);
                                } else if (!strcasecmp(var, "auto-create-schemas")) {