mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-10 04:49:29 +02:00
Add env variable to control Gong start time
This commit is contained in:
parent
5c9c70dffb
commit
0b07d615b1
@ -138,6 +138,8 @@ CONFLUENCE_CONNECTOR_LABELS_TO_SKIP = [
|
||||
if ignored_tag
|
||||
]
|
||||
|
||||
GONG_CONNECTOR_START_TIME = os.environ.get("GONG_CONNECTOR_START_TIME")
|
||||
|
||||
#####
|
||||
# Query Configs
|
||||
#####
|
||||
|
@ -9,6 +9,7 @@ from typing import cast
|
||||
import requests
|
||||
|
||||
from danswer.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE
|
||||
from danswer.configs.app_configs import GONG_CONNECTOR_START_TIME
|
||||
from danswer.configs.app_configs import INDEX_BATCH_SIZE
|
||||
from danswer.configs.constants import DocumentSource
|
||||
from danswer.connectors.interfaces import GenerateDocumentsOutput
|
||||
@ -262,9 +263,21 @@ class GongConnector(LoadConnector, PollConnector):
|
||||
def poll_source(
|
||||
self, start: SecondsSinceUnixEpoch, end: SecondsSinceUnixEpoch
|
||||
) -> GenerateDocumentsOutput:
|
||||
# if this env variable is set, don't start from a timestamp before the specified
|
||||
# start time
|
||||
# TODO: remove this once this is globally available
|
||||
if GONG_CONNECTOR_START_TIME:
|
||||
special_start_datetime = datetime.fromisoformat(GONG_CONNECTOR_START_TIME)
|
||||
special_start_datetime = special_start_datetime.replace(tzinfo=timezone.utc)
|
||||
else:
|
||||
special_start_datetime = datetime.fromtimestamp(0, tz=timezone.utc)
|
||||
|
||||
start_datetime = max(
|
||||
datetime.fromtimestamp(start, tz=timezone.utc), special_start_datetime
|
||||
)
|
||||
|
||||
# Because these are meeting start times, the meeting needs to end and be processed
|
||||
# so adding a 1 day buffer and fetching by default till current time
|
||||
start_datetime = datetime.fromtimestamp(start, tz=timezone.utc)
|
||||
start_one_day_offset = start_datetime - timedelta(days=1)
|
||||
start_time = start_one_day_offset.isoformat()
|
||||
end_time = (
|
||||
@ -273,6 +286,7 @@ class GongConnector(LoadConnector, PollConnector):
|
||||
else None
|
||||
)
|
||||
|
||||
logger.info(f"Fetching Gong calls between {start_time} and {end_time}")
|
||||
return self._fetch_calls(start_time, end_time)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user