mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
fix(firms): use public is_published/mark_published methods
Match NWS adapter pattern for supervisor compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
47359a8144
commit
22c50d3176
2 changed files with 7 additions and 7 deletions
|
|
@ -175,7 +175,7 @@ class FIRMSAdapter(SourceAdapter):
|
||||||
self._db = None
|
self._db = None
|
||||||
logger.info("FIRMS adapter shut down")
|
logger.info("FIRMS adapter shut down")
|
||||||
|
|
||||||
def _is_published(self, stable_id: str) -> bool:
|
def is_published(self, stable_id: str) -> bool:
|
||||||
"""Check if an event has already been published."""
|
"""Check if an event has already been published."""
|
||||||
if not self._db:
|
if not self._db:
|
||||||
return False
|
return False
|
||||||
|
|
@ -185,7 +185,7 @@ class FIRMSAdapter(SourceAdapter):
|
||||||
)
|
)
|
||||||
return cur.fetchone() is not None
|
return cur.fetchone() is not None
|
||||||
|
|
||||||
def _mark_published(self, stable_id: str) -> None:
|
def mark_published(self, stable_id: str) -> None:
|
||||||
"""Mark an event as published."""
|
"""Mark an event as published."""
|
||||||
if not self._db:
|
if not self._db:
|
||||||
return
|
return
|
||||||
|
|
@ -383,12 +383,12 @@ class FIRMSAdapter(SourceAdapter):
|
||||||
row["longitude"],
|
row["longitude"],
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._is_published(stable_id):
|
if self.is_published(stable_id):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
event = self._row_to_event(row, satellite)
|
event = self._row_to_event(row, satellite)
|
||||||
yield event
|
yield event
|
||||||
self._mark_published(stable_id)
|
self.mark_published(stable_id)
|
||||||
new_count += 1
|
new_count += 1
|
||||||
|
|
||||||
total_new += new_count
|
total_new += new_count
|
||||||
|
|
|
||||||
|
|
@ -246,13 +246,13 @@ class TestDeduplication:
|
||||||
stable_id = "VIIRS_SNPP_NRT:2026-05-16:1430:45.123:-116.456"
|
stable_id = "VIIRS_SNPP_NRT:2026-05-16:1430:45.123:-116.456"
|
||||||
|
|
||||||
# Not published initially
|
# Not published initially
|
||||||
assert not adapter._is_published(stable_id)
|
assert not adapter.is_published(stable_id)
|
||||||
|
|
||||||
# Mark as published
|
# Mark as published
|
||||||
adapter._mark_published(stable_id)
|
adapter.mark_published(stable_id)
|
||||||
|
|
||||||
# Now should be published
|
# Now should be published
|
||||||
assert adapter._is_published(stable_id)
|
assert adapter.is_published(stable_id)
|
||||||
|
|
||||||
await adapter.shutdown()
|
await adapter.shutdown()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue