MCPcopy Create free account
hub / github.com/GerevAI/gerev / index

Method index

app/data_source/api/base_data_source.py:138–150  ·  view source on GitHub ↗
(self, force: bool = False)

Source from the content-addressed store, hash-verified

136 function(**kwargs)
137
138 def index(self, force: bool = False) -> None:
139 if self._last_task_time is not None and not force:
140 # Don't index if the last task was less than an hour ago
141 time_since_last_task = get_utc_time_now() - self._last_task_time
142 if time_since_last_task.total_seconds() < 60 * 60:
143 logging.info("Skipping indexing data source because it was indexed recently")
144 return
145
146 try:
147 self._save_index_time_in_db()
148 self._feed_new_documents()
149 except Exception as e:
150 logging.exception("Error while indexing data source")
151
152 def _is_prior_to_last_index_time(self, doc_time: datetime) -> bool:
153 if doc_time.tzinfo is not None and self._last_index_time.tzinfo is None:

Callers 1

_check_for_new_documentsFunction · 0.80

Calls 3

_feed_new_documentsMethod · 0.95
get_utc_time_nowFunction · 0.90

Tested by

no test coverage detected