]> git.ipfire.org Git - pbs.git/commitdiff
database: Log less
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Feb 2025 16:46:23 +0000 (16:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Feb 2025 16:46:23 +0000 (16:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/database.py

index c380b2b9c747e4eb0a2f0ea9abeec86e3c265c1a..8238d25f2c33845df01431384344b1249e4523fa 100644 (file)
@@ -34,36 +34,34 @@ from . import base
 # Setup logging
 log = logging.getLogger("pbs.database")
 
-@sqlalchemy.event.listens_for(sqlalchemy.Engine, "before_cursor_execute")
-def before_cursor_execute(conn, cursor, statement, parameters, context, executemany):
-       now = time.time()
-
-       # Create a queue to store start times
-       try:
-               q = conn.info["query_start_time"]
-       except KeyError:
-               q = conn.info["query_start_time"] = queue.LifoQueue()
-
-       # Push the start time of the query
-       q.put(now)
-
-       # Log the statement
-       log.debug("Start Query: %s %r", statement, parameters)
-
-
-@sqlalchemy.event.listens_for(sqlalchemy.Engine, "after_cursor_execute")
-def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
-       time_end = time.time()
-
-       # Fetch the latest start time
-       time_start = conn.info["query_start_time"].get()
-
-       # Compute the total time
-       t = time_end - time_start
-
-       # Log the total runtime
-       log.debug("Query completed in %.02fms", t * 1000)
-
+#@sqlalchemy.event.listens_for(sqlalchemy.Engine, "before_cursor_execute")
+#def before_cursor_execute(conn, cursor, statement, parameters, context, executemany):
+#      now = time.time()
+#
+#      # Create a queue to store start times
+#      try:
+#              q = conn.info["query_start_time"]
+#      except KeyError:
+#              q = conn.info["query_start_time"] = queue.LifoQueue()
+#
+#      # Push the start time of the query
+#      q.put(now)
+#
+#      # Log the statement
+#      log.debug("Start Query: %s %r", statement, parameters)
+#
+#@sqlalchemy.event.listens_for(sqlalchemy.Engine, "after_cursor_execute")
+#def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
+#      time_end = time.time()
+#
+#      # Fetch the latest start time
+#      time_start = conn.info["query_start_time"].get()
+#
+#      # Compute the total time
+#      t = time_end - time_start
+#
+#      # Log the total runtime
+#      log.debug("Query completed in %.02fms", t * 1000)
 
 class Base(sqlalchemy.ext.asyncio.AsyncAttrs, sqlalchemy.orm.DeclarativeBase):
        """