-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Conferences
-
Labels:None
When entering/leaving a conference, there's a AMI event that's triggered per user that restapps.php uses to then send the BLF notification.
However every event appears to repeat the same (cacheable) SQL query. Updating 2000 users is really slow and cpu intensive currently, this should be a simple optimization to make.
strace output showing the queries for a particular user:
write(13, "[21946][6507-conferences] Setting button linekeys:8 to IN_USE\n\n\n", 64) = 64
write(9, " \0\0\0\3SELECT * FROM restapps_settings", 36) = 36
read(9, "\1\0\0\1\3L\0\0\2\3def\10asterisk\21restapps_settings\21restapps_settings\6module\6module\f!\0K\0\0\0\375\3@\0\0\0F\0\0\3\3def\10asterisk\21restapps_settings\21restapps_settings\3key\3key\f!\0K\0\0\0\375\3@\0\0\0J\0\0\4\3def\10asterisk\21restapps_settings\21restapps_settings\5value\5value\f!\0\360\0\0\0\375\0\0\0\0\0\5\0\0\5\376\0\0\2\0\5\0\0\6\376\0\0\2\0", 16384) = 255
write(9, "a\0\0\0\3SELECT * FROM endpoint_buttons WHERE `brand` = 'sangoma' AND `template_name` = 'sangoma_default'", 101) = 101
read(9, "\1\0\0\1\6B\0\0\2\3def\10asterisk\20endpoint_buttons\20endpoint_buttons\2id\2id\f?\0\24\0\0\0\3\3B\0\0\0H\0\0\3\3def\10asterisk\20endpoint_buttons\20endpoint_buttons\5brand\5brand\f!\0<\0\0\0\375\0\0\0\0\0X\0\0\4\3def\10asterisk\20endpoint_buttons\20endpoint_buttons\rtemplate_name\rtemplate_name\f!\0\207\0\0\0\375\0\0\0\0\0D\0\0\5\3def\10asterisk\20endpoint_buttons\20endpoint_buttons\3key\3key\f!\0\264\0\0\0\375\0\0\0\0\0H\0\0\6\3def\10asterisk\20endpoint_buttons\20endpoint_buttons\5value\5value\f!\0h\1\0\0\375\0\0\0\0\0N\0\0\7\3def\10asterisk\20endpoint_buttons\20endpoint_buttons\10daylight\10daylight\f!\0\6\0\0\0\375\0\0\0\0\0\5\0\0\10\376\0\0\"\0004\0\0\t\003168\7sangoma\17sangoma_default\24S300_linekeys_1_type\0011\373;\0\0\n\003169\7sangoma\17sangoma_default\24S300_linekeys_1_acct\10account1\3734\0\0\v\003170\7sangoma\17sangoma_default\24S300_linekeys_2_type\0011\373;\0\0\f\003171\7sangoma\17sangoma_default\24S300_linekeys_2_acct\10account1\373>\0\0\r\003172\7sangoma\17sangoma_default\32S300_horsoftkeys_At2_value\5Empty\373B\0\0\16\003173\7sangoma\17sangoma_default\31S300_horsoftkeys_At2_type\nhorizontal\373A\0\0\17\003174\7sangoma\17sangoma_default\32S300_horsoftkeys_At1_value\10Transfer\373B\0\0\20\003175\7sangoma\17sangoma_default\31S300_horsoftkeys_At1_type\nhorizontal\373?\0\0\21"..., 16384) = 16384
read(9, "default\31S700_horsoftkeys_Br1_type\nhorizontal\373@\0\0\364\0041222\7sangoma\17sangoma_default\32S700_horsoftkeys_Pr4_value\6Cancel\373C\0\0\365\0041219\7sangoma\17sangoma_default\31S700_horsoftkeys_Pr3_type\nhorizontal\373@\0\0\366\0041220\7sangoma\17sangoma_default\32S700_horsoftkeys_Pr3_value\6Delete\373C\0\0\367\0041221\7sangoma\17sangoma_default\31S700_horsoftkeys_Pr4_type\nhorizontal\373C\0\0\370\0041217\7sangoma\17sangoma_default\31S700_horsoftkeys_Pr2_type\nhorizontal\373>\0\0\371\0041218\7sangoma\17sangoma_default\32S700_horsoftkeys_Pr2_value\4Send\373B\0\0\372\0041216\7sangoma\17sangoma_default\32S700_horsoftkeys_Pr1_value\10Transfer\373@\0\0\373\0041214\7sangoma\17sangoma_default\32S700_horsoftkeys_He4_value\6Cancel\373C\0\0\374\0041215\7sangoma\17sangoma_default\31S700_horsoftkeys_Pr1_type\nhorizontal\373?\0\0\375\0041212\7sangoma\17sangoma_default\32S700_horsoftkeys_He3_value\5Empty\373C\0\0\376\0041213\7sangoma\17sangoma_default\31S700_horsoftkeys_He4_type\nhorizontal\373C\0\0\377\0041209\7sangoma\17sangoma_default\31S700_horsoftkeys_He2_type\nhorizontal\373?\0\0\0\0041210\7sangoma\17sangoma_default\32S700_horsoftkeys_He2_value\5Empty\373C\0\0\1\0041211\7sangoma\17sangoma_default\31S700_horsoftkeys_He3"..., 16384) = 11920
write(13, "2016-Jul-19 17:47:06\t/var/www/html/admin/modules/restapps/functions.inc/aastra.class.php:1502\n\n\n", 96) = 96
The two statements that repeat are:
- SELECT * FROM restapps_settings
- SELECT * FROM endpoint_buttons WHERE `brand` = 'sangoma' AND `template_name` = 'sangoma_default'