hooks/__init__.py
changeset 9746 81b56897a377
parent 9456 a79e88aad555
child 9775 614f8f3d2a35
--- a/hooks/__init__.py	Fri Apr 04 17:57:58 2014 +0200
+++ b/hooks/__init__.py	Fri Apr 04 18:23:02 2014 +0200
@@ -60,13 +60,11 @@
                     or not repo.config.source_enabled(source)
                     or not source.config['synchronize']):
                     continue
-                session = repo.internal_session(safe=True)
-                try:
-                    source.pull_data(session)
-                except Exception as exc:
-                    session.exception('while trying to update feed %s', source)
-                finally:
-                    session.close()
+                with repo.internal_connection() as cnx:
+                    try:
+                        source.pull_data(cnx)
+                    except Exception as exc:
+                        cnx.exception('while trying to update feed %s', source)
         self.repo.looping_task(60, update_feeds, self.repo)