keith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-msc/+/28345
)
Change subject: Add VTY command for SMS queue trigger holdoff
......................................................................
Add VTY command for SMS queue trigger holdoff
There are various places in the code that retrigger the SMS -> In Memory pending queue
mechanism. The default was to trigger the queue in one second, which could result in
running the queue every second.
This parameter can ease the queue run interval in case one second is causing too
much load. Sms _SHOULD_ be delivered anyway without these queue runs, due to for
example, MS becoming available or due to being notified by the call back of a new SMS.
Change-Id: I43d88342436d654afd6d955e304e7f85fbc4840f
---
M include/osmocom/msc/sms_queue.h
M src/libmsc/sms_queue.c
M src/libmsc/smsc_vty.c
3 files changed, 24 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/45/28345/1
diff --git a/include/osmocom/msc/sms_queue.h b/include/osmocom/msc/sms_queue.h
index e4b2a12..9ada525 100644
--- a/include/osmocom/msc/sms_queue.h
+++ b/include/osmocom/msc/sms_queue.h
@@ -32,6 +32,7 @@
bool delete_expired; /* delete expired SMS from DB? */
unsigned int minimum_validity_mins; /* minimum validity period in minutes */
unsigned int default_validity_mins; /* default validity period in minutes */
+ unsigned int trigger_holdoff; /* How often can the queue be re-triggered? */
};
struct sms_queue_config *sms_queue_cfg_alloc(void *ctx);
diff --git a/src/libmsc/sms_queue.c b/src/libmsc/sms_queue.c
index b6f92e2..eb0118d 100644
--- a/src/libmsc/sms_queue.c
+++ b/src/libmsc/sms_queue.c
@@ -441,14 +441,21 @@
sms_submit_pending(net->sms_queue);
}
-/* Trigger a call to sms_submit_pending() in one second */
+/* Trigger a call to sms_submit_pending() in x seconds */
int sms_queue_trigger(struct gsm_sms_queue *smsq)
{
- LOGP(DLSMS, LOGL_DEBUG, "Triggering SMS queue\n");
- if (osmo_timer_pending(&smsq->push_queue))
- return 0;
+ struct timeval tv;
- osmo_timer_schedule(&smsq->push_queue, 1, 0);
+ LOGP(DLSMS, LOGL_DEBUG, "Triggering SMS queue\n");
+ if (osmo_timer_pending(&smsq->push_queue)) {
+ if (osmo_timer_remaining(&smsq->push_queue, NULL, &tv) == -1)
+ return 0;
+ LOGP(DLSMS, LOGL_INFO, "SMS queue already set to run in %lu seconds.\n",
+ tv.tv_sec);
+ return 0;
+ }
+
+ osmo_timer_schedule(&smsq->push_queue, smsq->cfg->trigger_holdoff, 0);
return 0;
}
@@ -464,6 +471,7 @@
sqcfg->delete_expired = true;
sqcfg->default_validity_mins = 7 * 24 * 60; /* 7 days */
sqcfg->minimum_validity_mins = 1;
+ sqcfg->trigger_holdoff = 1;
sqcfg->db_file_path = talloc_strdup(ctx, SMS_DEFAULT_DB_FILE_PATH);
return sqcfg;
diff --git a/src/libmsc/smsc_vty.c b/src/libmsc/smsc_vty.c
index e99b236..0cc4af4 100644
--- a/src/libmsc/smsc_vty.c
+++ b/src/libmsc/smsc_vty.c
@@ -60,6 +60,14 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_sms_trigger_holdoff, cfg_sms_trigger_holdoff_cmd,
+ "queue trigger-holdoff <1-600>",
+ "SMS Queue\n" "How often can the Queue be re-triggered.\n"
"Seconds\n")
+{
+ smqcfg->trigger_holdoff = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_sms_queue_max, cfg_sms_queue_max_cmd,
"queue max-pending <1-500>",
"SMS Queue\n" "SMS to deliver in parallel\n"
"Amount\n")
@@ -175,6 +183,7 @@
if (smqcfg->db_file_path && strcmp(smqcfg->db_file_path,
SMS_DEFAULT_DB_FILE_PATH))
vty_out(vty, " database %s%s", smqcfg->db_file_path, VTY_NEWLINE);
+ vty_out(vty, " queue trigger-holdoff %u%s", smqcfg->trigger_holdoff,
VTY_NEWLINE);
vty_out(vty, " queue max-pending %u%s", smqcfg->max_pending, VTY_NEWLINE);
vty_out(vty, " queue max-failure %u%s", smqcfg->max_fail, VTY_NEWLINE);
@@ -197,6 +206,7 @@
install_element(CONFIG_NODE, &cfg_smsc_cmd);
install_node(&smsc_node, config_write_smsc);
install_element(SMSC_NODE, &cfg_sms_database_cmd);
+ install_element(SMSC_NODE, &cfg_sms_trigger_holdoff_cmd);
install_element(SMSC_NODE, &cfg_sms_queue_max_cmd);
install_element(SMSC_NODE, &cfg_sms_queue_fail_cmd);
install_element(SMSC_NODE, &cfg_sms_db_del_delivered_cmd);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/28345
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I43d88342436d654afd6d955e304e7f85fbc4840f
Gerrit-Change-Number: 28345
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith(a)rhizomatica.org>
Gerrit-MessageType: newchange