Skip to content

Commit b03228f

Browse files
committed
Add direct connection logs
1 parent b81728a commit b03228f

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/sasquatchbackpack/sasquatch.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _get_source_records(self) -> list[dict] | None:
219219
if self.redis.get(self.source.get_redis_key(record)) is None
220220
]
221221

222-
async def direct_connect(self) -> None:
222+
async def direct_connect(self) -> tuple[str, list]:
223223
"""Assemble a schema and payload from the given source,
224224
and route data directly to kafka.
225225
"""
@@ -228,15 +228,22 @@ async def direct_connect(self) -> None:
228228
await kafka_broker.connect()
229229

230230
@kafka_broker.publisher(self.config.namespace)
231-
async def dothing(self: Self) -> list[dict] | None:
231+
async def dothing(self: Self) -> tuple[str, list]:
232232
records: list[dict] | None = self._get_source_records()
233233
if records is None:
234-
return None
234+
return (
235+
"Warning: No entries found, aborting POST request",
236+
[],
237+
)
235238
if len(records) == 0:
236-
return None
237-
return records
238-
239-
await dothing(self)
239+
return (
240+
"Warning: All entries already present,"
241+
" aborting POST request",
242+
records,
243+
)
244+
return "Sent thing", records
245+
246+
return await dothing(self)
240247

241248
def post(self) -> tuple[str, list]:
242249
"""Assemble schema and payload from the given source, then

0 commit comments

Comments
 (0)