Browse Source

Fix bug on missing subunit2sql data

This commit fixes an issue when handling a nonexistent subunit stream.
The script was returning on gearman an error but then continued to
use the internally queue up the subunit event to process, even though
there wasn't a stream. This would cause a stacktrace later when the
actual processing was done on the internal queue. This commit adds
the queueing inside an else block to prevent it from running when
we don't have a subunit stream.

Change-Id: I66fdc5d7ae3702411a0b42757087cf61a4c69e35
Matthew Treinish 3 years ago
parent
commit
d8063ad5f5
No account linked to committer's email address
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      files/subunit-gearman-worker.py

+ 6
- 5
files/subunit-gearman-worker.py View File

@@ -85,11 +85,12 @@ class SubunitRetriever(threading.Thread):
85 85
                 if not subunit_io:
86 86
                     job.sendWorkException(
87 87
                         'Unable to retrieve subunit stream'.encode('utf8'))
88
-                logging.debug("Pushing subunit files.")
89
-                out_event = fields.copy()
90
-                out_event["subunit"] = subunit_io
91
-                self.subunitq.put(out_event)
92
-            job.sendWorkComplete()
88
+                else:
89
+                    logging.debug("Pushing subunit files.")
90
+                    out_event = fields.copy()
91
+                    out_event["subunit"] = subunit_io
92
+                    self.subunitq.put(out_event)
93
+                    job.sendWorkComplete()
93 94
         except Exception as e:
94 95
             logging.exception("Exception handling log event.")
95 96
             job.sendWorkException(str(e).encode('utf-8'))

Loading…
Cancel
Save