*** empty log message ***
This commit is contained in:
parent
c2887c0857
commit
9a0785830c
|
@ -1,3 +1,6 @@
|
|||
2009-02-16 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Improved pgsql queue module performance
|
||||
* MM1 queue changes - expire message even if fetched at least once
|
||||
2009-02-11 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Fix: Improved pgsql queue processing -- prevent queue flooding
|
||||
2009-02-09 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
|
|
|
@ -347,10 +347,10 @@ static int pgq_free_envelope(MmsEnvelope *e, int removefromqueue)
|
|||
|
||||
static MmsEnvelope *pgq_queue_readenvelope_ex(char *qf, char *mms_queuedir, int shouldblock, int check_send_time)
|
||||
{
|
||||
int64_t qid;
|
||||
int64_t qid = -1;
|
||||
long num_attempts, i, n;
|
||||
time_t sendt, created, lastt, edate;
|
||||
char cmd[4*QFNAMEMAX], _qf[QFNAMEMAX*2+1];
|
||||
char cmd[4*QFNAMEMAX];
|
||||
char data_file[4*QFNAMEMAX+1];
|
||||
Octstr *from = NULL;
|
||||
|
||||
|
@ -363,15 +363,13 @@ static MmsEnvelope *pgq_queue_readenvelope_ex(char *qf, char *mms_queuedir, int
|
|||
|
||||
if (c == NULL)
|
||||
return NULL;
|
||||
n = strlen(qf);
|
||||
PQescapeStringConn(c, _qf, qf, n < QFNAMEMAX ? n : QFNAMEMAX, NULL);
|
||||
|
||||
|
||||
sscanf(qf, "%*cf%lld", &qid); /* read back ID */
|
||||
|
||||
/* read and block, to ensure no one else touches it. */
|
||||
sprintf(cmd, "SELECT id,cdate,lastt,sendt,edate,num_attempts,sender,data FROM "
|
||||
" mms_messages_view WHERE qdir='%.128s' AND qfname = '%.256s' %s FOR UPDATE %s",
|
||||
mms_queuedir, _qf,
|
||||
sprintf(cmd, "SELECT id,cdate,lastt,sendt,edate,num_attempts,sender,data,qfname FROM "
|
||||
" mms_messages_view WHERE qdir='%.128s' AND id = %lld %s FOR UPDATE %s",
|
||||
mms_queuedir, qid,
|
||||
check_send_time ? " AND send_time <= current_timestamp " : "",
|
||||
shouldblock ? "" : "NOWAIT"); /* nice little PostgreSQL 8.x addition. */
|
||||
r = PQexec(c, cmd);
|
||||
|
@ -379,6 +377,12 @@ static MmsEnvelope *pgq_queue_readenvelope_ex(char *qf, char *mms_queuedir, int
|
|||
if (PQresultStatus(r) != PGRES_TUPLES_OK || PQntuples(r) < 1) {
|
||||
return_conn(c);
|
||||
goto done;
|
||||
} else if ((s = PQgetvalue(r, 0, PQfnumber(r, "qfname"))) == NULL ||
|
||||
strcmp(s, qf) != 0) {
|
||||
mms_warning(0, "pgsql_queue", NULL, "mms_queueread: Mismatch in ID for qf[%s] dir[%s]. Skipped.",
|
||||
qf, mms_queuedir);
|
||||
return_conn(c);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Get top-level values. */
|
||||
|
|
|
@ -163,13 +163,15 @@ static int sendNotify(MmsEnvelope *e)
|
|||
char *prov_notify_event = NULL;
|
||||
char *rtype = NULL;
|
||||
|
||||
#if 0 /* ... because we don't want fetched messages sticking around in queue forever */
|
||||
|
||||
if (e->lastaccess != 0) { /* This message has been fetched at least once, no more signals. */
|
||||
e->sendt = e->expiryt + 3600*24*30*12;
|
||||
|
||||
mms_info(0, "MM1", NULL, "Message [ID: %s] fetched/touched at least once. Skipping",
|
||||
e->xqfname);
|
||||
return settings->qfs->mms_queue_update(e);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!xto) {
|
||||
mms_error(0, "MM1", NULL, "mobilesender: Queue entry %s with no recipients!",
|
||||
|
@ -200,9 +202,22 @@ static int sendNotify(MmsEnvelope *e)
|
|||
|
||||
prov_notify_event = "failedfetch";
|
||||
rtype = "Expired";
|
||||
goto done;
|
||||
} else if (e->lastaccess != 0) {
|
||||
e->sendt = e->expiryt + 1;
|
||||
res = MMS_SEND_OK;
|
||||
err = octstr_create("Skipped");
|
||||
|
||||
mms_info(0, "MM1", NULL, "Message [ID: %s] fetched/touched at least once. Skipping",
|
||||
e->xqfname);
|
||||
if (settings->qfs->mms_queue_update(e) != 1)
|
||||
settings->qfs->mms_queue_free_env(e);
|
||||
e = NULL;
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
j = octstr_case_search(to, octstr_imm("/TYPE=PLMN"), 0);
|
||||
k = octstr_case_search(to, octstr_imm("/TYPE=IPv"), 0);
|
||||
len = octstr_len(to);
|
||||
|
|
Loading…
Reference in New Issue