More simple ZT performance improvements and profiler decorator bugfix

This commit is contained in:
VakarisZ 2020-04-30 17:45:16 +03:00
parent 9be8d4af1b
commit 7a13e71588
2 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class ZeroTrustService(object):
worst_status = zero_trust_consts.STATUS_UNEXECUTED
all_statuses = set()
for test in principle_tests:
all_statuses |= set(Finding.objects(test=test).distinct("status"))
all_statuses |= set(Finding.objects(test=test).exclude('events').distinct("status"))
for status in all_statuses:
if zero_trust_consts.ORDERED_TEST_STATUSES.index(status) \
@ -78,7 +78,7 @@ class ZeroTrustService(object):
def __get_tests_status(principle_tests):
results = []
for test in principle_tests:
test_findings = Finding.objects(test=test)
test_findings = Finding.objects(test=test).exclude('events')
results.append(
{
"test": zero_trust_consts.TESTS_MAP[test][zero_trust_consts.TEST_EXPLANATION_KEY],

View File

@ -6,12 +6,12 @@ PROFILER_LOG_DIR = "./profiler_logs/"
def profile(sort_args=['cumulative'], print_args=[100]):
profiler = Profile()
def decorator(fn):
def inner(*args, **kwargs):
result = None
try:
profiler = Profile()
result = profiler.runcall(fn, *args, **kwargs)
finally:
try: