Fixed a bug of multiple telemetry exports in a single island run.

This commit is contained in:
VakarisZ 2020-05-13 16:39:47 +03:00
parent 194210925c
commit a360e8514e
2 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,8 @@ logger = logging.getLogger(__name__)
class TestTelemStore:
TELEMS_EXPORTED = False
@staticmethod
def store_test_telem(f):
@wraps(f)
@ -46,6 +48,7 @@ class TestTelemStore:
for test_telem in TestTelem.objects():
with open(TestTelemStore.get_unique_file_path_for_test_telem(TELEM_SAMPLE_DIR, test_telem), 'w') as file:
file.write(test_telem.to_json(indent=2))
TestTelemStore.TELEMS_EXPORTED = True
logger.info("Telemetries exported!")
@staticmethod

View File

@ -47,5 +47,5 @@ class InfectionLifecycle:
# we want to skip and reply.
if not is_report_being_generated() and not ReportService.is_latest_report_exists():
safe_generate_reports()
if ConfigService.is_test_telem_export_enabled():
if ConfigService.is_test_telem_export_enabled() and not TestTelemStore.TELEMS_EXPORTED:
TestTelemStore.export_test_telems()