Skip to content

Commit

Permalink
Bug fix: subclass out of ExportFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ynaim94-harrys committed Oct 27, 2022
1 parent c2f6613 commit 453d365
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tap-gladly"
version = "0.4.0"
version = "0.4.1"
description = "`tap-gladly` is a Singer tap for gladly, built with the Meltano SDK for Singer Taps."
authors = ["harrystech"]
keywords = [
Expand Down
11 changes: 8 additions & 3 deletions tap_gladly/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ class ExportFile(gladlyStream, abc.ABC):
def get_records(self, context: Optional[Dict[Any, Any]]):
"""Get records that exists, ignoring older jobs if max_job_lookback is setup."""
if not context:
logging.warning("Context is empty, nothing to do")
return []
period = pendulum.now().diff(pendulum.parse(context["updatedAt"])).in_days()
if "max_job_lookback" in self.config:
logging.info(f"Max job lookback is set to {self.config['max_job_lookback']}")
logging.info(
f"Max job lookback is set to {self.config['max_job_lookback']}"
)
if period <= self.config["max_job_lookback"]:
logging.info(f"{period} <= {self.config['max_job_lookback']}, syncing ...")
logging.info(
f"{period} <= {self.config['max_job_lookback']}, syncing ..."
)
return super().get_records(context)
else:
logging.warning(
Expand Down Expand Up @@ -82,7 +87,7 @@ def parse_response(self, response: requests.Response) -> Iterable[dict]:
yield from extract_jsonpath(self.records_jsonpath, input=json.loads(line))


class ExportFileConversationItemsAllTypesStream(gladlyStream):
class ExportFileConversationItemsAllTypesStream(ExportFile):
"""Stream with all the conversations and content type."""

name = "conversation_all_types"
Expand Down

0 comments on commit 453d365

Please sign in to comment.