Browse code

boobank-cacher: do not cache data-less results.

Xavier G authored on 26/11/2017 12:05:31
Showing 1 changed files

... ...
@@ -92,6 +92,9 @@ def write_cache(results):
92 92
     for command in results.get('commands', []):
93 93
         if 'result' not in command or 'cache_path' not in command:
94 94
             continue
95
+		# There is no point caching data-less results:
96
+        if 'data' not in command['result'] or not command['result']['data']:
97
+            continue
95 98
         cache_path = os.path.expanduser(command['cache_path'])
96 99
         mkdir(os.path.dirname(cache_path), 0700)
97 100
         with open(cache_path, 'w') as filedesc: