Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vulnerabilities/templates/pipeline_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ <h1>Pipeline Dashboard</h1>
worker{{ additional|pluralize }} for the {{ queue_name }} queue.">
<span class="icon"><i class="fa fa-exclamation-triangle"></i></span>
</span>
{% elif load_factor < 1 %}
{% elif additional < 1 %}
<span class="has-text-weight-bold is-size-6 has-text-success has-tooltip-arrow has-tooltip-multiline has-tooltip-success"
data-tooltip="{{ queue_name|capfirst }} queue perfectly balanced.">
{{ load_factor|floatformat:2 }}
<span class="icon"><i class="fa fa-check-circle"></i></span>
</span>
{% elif load_factor < 1.6 %}
{% elif additional < 2 %}
<span class="has-text-weight-bold is-size-6 has-text-orange has-tooltip-arrow has-tooltip-multiline has-tooltip-orange"
data-tooltip="Consider adding {{ additional }} additional worker{{ additional|pluralize }} to the {{ queue_name }} queue.">
{{ load_factor|floatformat:2 }}
Expand Down
5 changes: 2 additions & 3 deletions vulnerabilities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

PAGE_SIZE = 10

CACHE_TIMEOUT = 60 * 5


class VulnerableCodeView(View):
"""
Expand Down Expand Up @@ -965,11 +963,12 @@ def get_queryset(self):

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
cache_timeout = 60 * 10
load_per_queue = cache.get("load_per_queue")

if load_per_queue is None:
load_per_queue = compute_queue_load_factor()
cache.set("load_per_queue", load_per_queue, CACHE_TIMEOUT)
cache.set("load_per_queue", load_per_queue, cache_timeout)

context["load_per_queue"] = load_per_queue
context["active_pipeline_count"] = PipelineSchedule.objects.filter(is_active=True).count()
Expand Down
12 changes: 12 additions & 0 deletions vulnerablecode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,18 @@
}


vcio_redis_host = env.str("VULNERABLECODE_REDIS_HOST", default=None)
vcio_redis_port = env.str("VULNERABLECODE_REDIS_PORT", default=None)

if vcio_redis_host and vcio_redis_port:
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": f"redis://{vcio_redis_host}:{vcio_redis_port}",
}
}


# FederatedCode integration

FEDERATEDCODE_VULNERABILITIES_REPO = env.str(
Expand Down
Loading