You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/20 07:57:20 UTC

[buildstream] 01/01: _frontend/app.py: Flush cached messages before printing summary

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

tvb pushed a commit to branch tristan/fix-logging-race
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit ab45fe707eabd3b8fb85791f0281c5ea81822040
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Sat Aug 20 16:55:14 2022 +0900

    _frontend/app.py: Flush cached messages before printing summary
    
    This should fix the spurrious error we've been seeing with
    tests/frontend/logging.py::test_failed_build_listing().
    
    It appears that depending on what is in the cache we don't always get
    all of the messages we expect, and indeed we were not flushing the message
    cache consistently at the end of sessions.
---
 src/buildstream/_frontend/app.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/buildstream/_frontend/app.py b/src/buildstream/_frontend/app.py
index 303c9636a..1e2a11301 100644
--- a/src/buildstream/_frontend/app.py
+++ b/src/buildstream/_frontend/app.py
@@ -318,6 +318,8 @@ class App:
                         # Notify session failure
                         self._notify("{} failed".format(session_name), e)
 
+                    # Flush cached messages before printing the summary
+                    self._render(message_text=self._message_text)
                     if self._started:
                         self._print_summary()
                 else:
@@ -337,6 +339,9 @@ class App:
                 # No exceptions occurred, print session time and summary
                 if session_name:
                     self._message(MessageType.SUCCESS, session_name, elapsed=self._state.elapsed_time())
+
+                    # Flush cached messages before printing the summary
+                    self._render(message_text=self._message_text)
                     if self._started:
                         self._print_summary()