diff mbox series

[OSSTEST,27/60] sg-report-host-history: Write cache entry for unfinished jobs

Message ID 20200814172205.9624-28-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Speed up sg-report-job-history | expand

Commit Message

Ian Jackson Aug. 14, 2020, 5:21 p.m. UTC
We have to also check ->{finished}, rather than the existence of a row
at all, since now unfinished jobs can appear in the cache.

Because the cache key includes the job status, when the job becomes
finished the cache entry will be invalidated.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 sg-report-host-history | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sg-report-host-history b/sg-report-host-history
index 2ad2134d..6bf14aa2 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -214,7 +214,8 @@  END
 	cache_row_lookup_prep(\$jr);
 
 	my $endedrow = cacheable_query($endedq, $jr, 'e');
-	if (!$endedrow) {
+	if (!defined $endedrow->{finished}) {
+	    cache_write_entry(\*H, $jr);
 	    #print DEBUG "no-finished\n";
 	    next;
 	}