Skip to content

Instantly share code, notes, and snippets.

View valinurovam's full-sized avatar

Valinurov Alexander valinurovam

View GitHub Profile
process_file(StatusFileName, Table) ->
FileName = ?STATUS_FILES_DIR ++ StatusFileName,
case file:open(FileName, read) of
{ok, IoD} ->
HttpURL = io:get_line(IoD, ''),
case httpc:request(HttpURL) of
{ok, {{_Version, HttpStatus, ReasonPhrase}, _Headers, _Body}} ->
case HttpStatus of
200 ->
file:delete(FileName),
%% LAGER config
{lager, [
{handlers, [
{lager_console_backend, info},
{lager_file_backend, [
{"status_server.err.log", error, 1048576000, "$D0", 5},
{"status_server.info.log", info, 1048576000, "$D0", 5}
]}
]}
]}
.
├── apps
│   └── smpp_server
│   ├── ebin
│   ├── include
│   ├── priv
│   └── src
├── deps
│   ├── common_lib
│   │   ├── app.mk
#tprice{partner_price = PartnerPrice,
system_price = SystemPrice,
manager_price = ManagerPrice,
partner_pay_on_dlr = _PartnerPDLR,
manager_pay_on_dlr = _MangerPDLR,
channel_pay_on_dlr = _ChannelPDLR} = smpp_billing_server:get_price_info({PartnerID, CountryID, ChannelID}),
Status = 1,
emysql:prepare(insert_pdu_stmt, <<"insert into mbstat.smpp_in_pdu values(null, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)">>),
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO
#
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
mysql> show create table smpp_in_pdu \G
*************************** 1. row ***************************
Table: smpp_in_pdu
Create Table: CREATE TABLE `smpp_in_pdu` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`seq_number` int(11) unsigned NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`partner_id` int(11) unsigned NOT NULL,
`channel_id` int(11) unsigned NOT NULL,
[root@master sqldump]# gzip openbill_2012_09_11_dump.sql
Убито
[root@master sqldump]#
Message from syslogd@ at Tue Sep 11 13:16:08 2012 ...
master kernel: Oops: 0002 [#8] SMP
Message from syslogd@ at Tue Sep 11 13:16:08 2012 ...
master kernel: last sysfs file: /sys/devices/system/cpu/cpu7/cache/index2/shared_cpu_map
Message from syslogd@ at Tue Sep 11 13:16:08 2012 ...
-module(smpp_queue_server).
-behaviour(gen_server).
-define(SERVER, ?MODULE).
-define(QUEUE, smpp_queue).
%%% RECORDS
-record(status, {
{_,_,_, [[LastInsertID]],_} = emysql:execute(?DB, <<"select mbstat.smpp_in_pdu_add(
", proplists:get_value(sequence_number, PDUArgs, undefined)/binary, ",
", proplists:get_value(pdu_status, PDUArgs, undefined)/binary, ",
", proplists:get_value(partner_id, PDUArgs, undefined)/binary, ",
", proplists:get_value(channel_id, PDUArgs, undefined)/binary, ",
", proplists:get_value(country_id, PDUArgs, undefined)/binary, ",
", proplists:get_value(destination_addr, PDUArgs, undefined)/binary, ",
", proplists:get_value(source_addr, PDUArgs, undefined)/binary, ",
", proplists:get_value(short_message, PDUArgs, undefined)/binary, ",
", proplists:get_value(partner_price, PDUArgs, undefined)/binary, ",
handle_submit_sm(Pid, Pdu, _From, St) ->
[{_, PartnerID, IP}] = ets:lookup(?SESSIONS, Pid),
lager:info("Method: submit_sm PartnerID: ~p PDU: ~p IP: ~p", [PartnerID, Pdu, IP]),
try
PDUArgs = smpp_tools:get_message_details(Pdu, PartnerID),
LastInsertID = save_pdu_to_db(PDUArgs),