This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new f1191bd  Remove unnecessary uses of traceback
f1191bd is described below

commit f1191bd63be96697fb79171e28bc14d2a2dcf811
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Mar 13 14:11:50 2025 +0200

    Remove unnecessary uses of traceback
---
 atr/server.py    | 3 ++-
 atr/tasks/rat.py | 3 +--
 atr/worker.py    | 7 ++-----
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/atr/server.py b/atr/server.py
index 87cba7a..ac745e1 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -72,8 +72,9 @@ def register_routes(app: base.QuartApp) -> tuple[str, ...]:
     async def handle_any_exception(error: Exception) -> Any:
         import traceback
 
+        # Required to give to the error.html template
         tb = traceback.format_exc()
-        app.logger.error(f"Unhandled exception: {error}\n{tb}")
+        app.logger.exception("Unhandled exception")
         return await quart.render_template("error.html", error=str(error), 
traceback=tb, status_code=500), 500
 
     @app.errorhandler(base.ASFQuartException)
diff --git a/atr/tasks/rat.py b/atr/tasks/rat.py
index c899a15..8bd74d9 100644
--- a/atr/tasks/rat.py
+++ b/atr/tasks/rat.py
@@ -215,10 +215,9 @@ def _check_licenses_core(
                 }
 
     except Exception as e:
-        _LOGGER.error(f"Error running Apache RAT: {e}")
         import traceback
 
-        _LOGGER.error(traceback.format_exc())
+        _LOGGER.exception("Error running Apache RAT")
         return {
             "valid": False,
             "message": f"Failed to run Apache RAT: {e!s}",
diff --git a/atr/worker.py b/atr/worker.py
index 48f2efd..a94bad4 100644
--- a/atr/worker.py
+++ b/atr/worker.py
@@ -259,14 +259,11 @@ async def _worker_loop_run() -> None:
                 # This prevents memory leaks from accumulating
                 break
             else:
-                # No tasks available, wait 20ms before checking again
+                # No tasks available, wait 100ms before checking again
                 await asyncio.sleep(0.1)
         except Exception:
             # TODO: Should probably be more robust about this
-            # Extract the traceback and log it
-            import traceback
-
-            _LOGGER.error(f"Worker loop error: {traceback.format_exc()}")
+            _LOGGER.exception("Worker loop error")
             await asyncio.sleep(1)
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to