From 205058de215825bda749b82c1f732969b44f6c9c Mon Sep 17 00:00:00 2001 From: goodboy Date: Fri, 30 Jan 2026 14:46:23 -0500 Subject: [PATCH] Always overwrite tsdb duplicates found during backfill Enable the previously commented-out dedupe-and-write logic in `start_backfill()` to ensure tsdb stays clean of duplicate entries. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- piker/tsp/_history.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/piker/tsp/_history.py b/piker/tsp/_history.py index d416c679..e875bab7 100644 --- a/piker/tsp/_history.py +++ b/piker/tsp/_history.py @@ -708,8 +708,16 @@ async def start_backfill( deduped, diff, ) = dedupe(df) - # if diff: - # sort_diff(df) + if diff: + log.warning( + f'Found {diff} duplicates in tsdb, ' + f'overwriting with deduped data\n' + ) + await storage.write_ohlcv( + col_sym_key, + deduped, + timeframe, + ) else: # finally filled gap