gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-21


From: Jan Derfinak
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-212-ga4937c8
Date: Sat, 09 Apr 2011 18:48:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  a4937c89b3f43c97dd062b9084a06b7c6ed7323a (commit)
      from  63d6f53b3d2978a79d187002bcf4bfae3f474a95 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=a4937c89b3f43c97dd062b9084a06b7c6ed7323a


commit a4937c89b3f43c97dd062b9084a06b7c6ed7323a
Author: Jan Derfinak <address@hidden>
Date:   Sat Apr 9 20:48:31 2011 +0200

    Changed DB_Look() to use one trasaction per sms instead of one big 
transaction for all sms in the outbox table.

diff --git a/configure.in b/configure.in
index edaed3d..a8f5139 100644
--- a/configure.in
+++ b/configure.in
@@ -35,7 +35,7 @@ dnl xgnokii version
 XVERSION=1.0
 
 dnl smsd version
-SVERSION=1.5.0
+SVERSION=1.5.1
 
 AC_CANONICAL_SYSTEM
 AC_GNU_SOURCE
diff --git a/smsd/ChangeLog b/smsd/ChangeLog
index d9f5b18..6f90ebb 100644
--- a/smsd/ChangeLog
+++ b/smsd/ChangeLog
@@ -1,4 +1,10 @@
-* Man 28 Feb 2011 Jan Derfinak
+* Sat 09 Apr 2011 Jan Derfinak
+- Changed DB_Look() to use one trasaction per sms instead of one big
+  transaction for all sms in the outbox table.
+- Version changed to 1.5.1
+
+
+* Mon 28 Feb 2011 Jan Derfinak
 - Changed type of column 'outbox.text' from 'varchar(160)' to 'text' to enable
   sending long sms in PostgreSQL.
 - Added CHECK () constrain to outbox table definition for PostgreSQL and
diff --git a/smsd/mysql.c b/smsd/mysql.c
index dcd296b..9d7617d 100644
--- a/smsd/mysql.c
+++ b/smsd/mysql.c
@@ -321,9 +321,11 @@ GNOKII_API void DB_Look (const gchar * const phone)
 
   buf = g_string_sized_new (256);
 
+  mysql_real_query (&mysqlOut, "BEGIN", strlen ("BEGIN"));
+  
   g_string_printf (buf, "SELECT id, number, text, dreport FROM outbox \
                          WHERE processed='0' AND CURTIME() >= not_before \
-                         AND CURTIME() <= not_after %s", phnStr->str);
+                         AND CURTIME() <= not_after %s LIMIT 1 FOR UPDATE", 
phnStr->str);
   g_string_free (phnStr, TRUE);
   
   if (mysql_real_query (&mysqlOut, buf->str, buf->len))
@@ -331,6 +333,7 @@ GNOKII_API void DB_Look (const gchar * const phone)
     g_print (_("%d: SELECT FROM outbox command failed.\n"), __LINE__);
     gn_log_xdebug ("%s\n", buf->str);
     g_print (_("Error: %s\n"), mysql_error (&mysqlOut));
+    mysql_real_query (&mysqlOut, "ROLLBACK TRANSACTION", strlen ("ROLLBACK 
TRANSACTION"));
     g_string_free (buf, TRUE);
     return;
   }
@@ -339,6 +342,7 @@ GNOKII_API void DB_Look (const gchar * const phone)
   {
     g_print (_("%d: Store Mysql Result Failed.\n"), __LINE__);
     g_print (_("Error: %s\n"), mysql_error (&mysqlOut));
+    mysql_real_query (&mysqlOut, "ROLLBACK TRANSACTION", strlen ("ROLLBACK 
TRANSACTION"));
     g_string_free (buf, TRUE);
     return;
   }
@@ -396,5 +400,7 @@ GNOKII_API void DB_Look (const gchar * const phone)
 
   mysql_free_result (res1);
 
+  mysql_real_query (&mysqlOut, "COMMIT", strlen ("COMMIT"));
+  
   g_string_free (buf, TRUE);
 }
diff --git a/smsd/pq.c b/smsd/pq.c
index 1a93b5a..0e7f05b 100644
--- a/smsd/pq.c
+++ b/smsd/pq.c
@@ -358,9 +358,12 @@ GNOKII_API void DB_Look (const gchar * const phone)
 
   buf = g_string_sized_new (256);
 
+  res1 = PQexec (connOut, "BEGIN");
+  PQclear (res1);
+
   g_string_printf (buf, "SELECT id, number, text, dreport FROM %s.outbox \
                          WHERE processed='f' AND localtime(0) >= not_before \
-                         AND localtime(0) <= not_after %s FOR UPDATE",
+                         AND localtime(0) <= not_after %s LIMIT 1 FOR UPDATE",
                    schema, phnStr->str);
   g_string_free (phnStr, TRUE);
 
@@ -371,6 +374,8 @@ GNOKII_API void DB_Look (const gchar * const phone)
     gn_log_xdebug ("%s\n", buf->str);
     g_print (_("Error: %s\n"), PQerrorMessage (connOut));
     PQclear (res1);
+    res1 = PQexec (connOut, "ROLLBACK TRANSACTION");
+    PQclear (res1);
     g_string_free (buf, TRUE);
     return;
   }
@@ -424,6 +429,8 @@ GNOKII_API void DB_Look (const gchar * const phone)
   }
 
   PQclear (res1);
+  res1 = PQexec (connOut, "COMMIT");
+  PQclear (res1);
 
   g_string_free (buf, TRUE);
 }
diff --git a/smsd/smsd.c b/smsd/smsd.c
index 2e0361b..779522a 100644
--- a/smsd/smsd.c
+++ b/smsd/smsd.c
@@ -373,8 +373,6 @@ static void *SendSMS (void *a)
     pthread_mutex_unlock (&db_monitorMutex);
 
     (*DB_Look) (smsdConfig.phone);
-
-    sleep (3);
   }
 }
 

-----------------------------------------------------------------------

Summary of changes:
 configure.in   |    2 +-
 smsd/ChangeLog |    8 +++++++-
 smsd/mysql.c   |    8 +++++++-
 smsd/pq.c      |    9 ++++++++-
 smsd/smsd.c    |    2 --
 5 files changed, 23 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]