(self, force: bool = False)
| 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: |
no test coverage detected