Jean-Frédéric has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/250202

Change subject: Keep alive connection to MySQL database using Ping
......................................................................

Keep alive connection to MySQL database using Ping

To avoid OperationalError: MySQL server has gone away

Bug: T117045
Change-Id: Ib49e120500f8d24dbe77fb10740ae8c1eed862b4
---
M erfgoedbot/categorize_images.py
M erfgoedbot/database_statistics.py
M erfgoedbot/images_of_monuments_without_id.py
M erfgoedbot/missing_commonscat_links.py
M erfgoedbot/populate_image_table.py
M erfgoedbot/unused_monument_images.py
M erfgoedbot/update_database.py
M erfgoedbot/update_id_dump.py
8 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage 
refs/changes/02/250202/1

diff --git a/erfgoedbot/categorize_images.py b/erfgoedbot/categorize_images.py
index 57de829..3f9c009 100644
--- a/erfgoedbot/categorize_images.py
+++ b/erfgoedbot/categorize_images.py
@@ -188,6 +188,7 @@
     '''
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db, 
user=config.db_username,
                            passwd=config.db_password, use_unicode=True, 
charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/database_statistics.py 
b/erfgoedbot/database_statistics.py
index 58fa9be..e1e65dc 100755
--- a/erfgoedbot/database_statistics.py
+++ b/erfgoedbot/database_statistics.py
@@ -18,6 +18,7 @@
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db,
                            user=config.db_username, passwd=config.db_password,
                            use_unicode=True, charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/images_of_monuments_without_id.py 
b/erfgoedbot/images_of_monuments_without_id.py
index 5266720..625415c 100644
--- a/erfgoedbot/images_of_monuments_without_id.py
+++ b/erfgoedbot/images_of_monuments_without_id.py
@@ -29,6 +29,7 @@
     '''
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db, 
user=config.db_username,
                            passwd=config.db_password, use_unicode=True, 
charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/missing_commonscat_links.py 
b/erfgoedbot/missing_commonscat_links.py
index 658eea4..c04ea2a 100644
--- a/erfgoedbot/missing_commonscat_links.py
+++ b/erfgoedbot/missing_commonscat_links.py
@@ -25,6 +25,7 @@
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db,
                            user=config.db_username, passwd=config.db_password,
                            use_unicode=True, charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/populate_image_table.py 
b/erfgoedbot/populate_image_table.py
index 782939f..3ffc122 100644
--- a/erfgoedbot/populate_image_table.py
+++ b/erfgoedbot/populate_image_table.py
@@ -40,6 +40,7 @@
     '''
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db, 
user=config.db_username,
                            passwd=config.db_password, use_unicode=True, 
charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/unused_monument_images.py 
b/erfgoedbot/unused_monument_images.py
index 578e4f8..ee73147 100644
--- a/erfgoedbot/unused_monument_images.py
+++ b/erfgoedbot/unused_monument_images.py
@@ -24,6 +24,7 @@
     '''
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db, 
user=config.db_username,
                            passwd=config.db_password, use_unicode=True, 
charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/update_database.py b/erfgoedbot/update_database.py
index ef08449..9d9f994 100755
--- a/erfgoedbot/update_database.py
+++ b/erfgoedbot/update_database.py
@@ -27,6 +27,7 @@
     '''
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db, 
user=config.db_username,
                            passwd=config.db_password, use_unicode=True, 
charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 
diff --git a/erfgoedbot/update_id_dump.py b/erfgoedbot/update_id_dump.py
index af9ca31..76712f0 100755
--- a/erfgoedbot/update_id_dump.py
+++ b/erfgoedbot/update_id_dump.py
@@ -28,6 +28,7 @@
     '''
     conn = MySQLdb.connect(host=mconfig.db_server, db=mconfig.db, 
user=config.db_username,
                            passwd=config.db_password, use_unicode=True, 
charset='utf8')
+    conn.ping(True)
     cursor = conn.cursor()
     return (conn, cursor)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/250202
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib49e120500f8d24dbe77fb10740ae8c1eed862b4
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Jean-Frédéric <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to