Skip to content

Commit

Permalink
fix: cache status report functions for 300s
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni committed Jul 12, 2024
1 parent 1cdcb4e commit f2ed25d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ckanext/versioned_datastore/lib/datastore_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from ckan import model
from ckan.plugins import toolkit, PluginImplementations
from splitgill.indexing.utils import DOC_TYPE
import time
from cachetools import cached, TTLCache

from . import common
from ..interfaces import IVersionedDatastore
Expand Down Expand Up @@ -288,6 +288,7 @@ def is_ingestible(resource):
)


@cached(cache=TTLCache(maxsize=10, ttl=30))
def get_queue_length(queue_name):
"""
This will only get the pending jobs in a queue, not any jobs that are currently
Expand All @@ -304,5 +305,6 @@ def get_queue_length(queue_name):
return len(queued_jobs)


@cached(cache=TTLCache(maxsize=10, ttl=30))
def get_es_health():
return {'ping': common.ES_CLIENT.ping(), 'info': common.ES_CLIENT.info()}

0 comments on commit f2ed25d

Please sign in to comment.