Skip to content

fix sticky timestamp issue#9

Open
Hanqing wants to merge 1 commit intowarproxxx:mainfrom
Hanqing:main
Open

fix sticky timestamp issue#9
Hanqing wants to merge 1 commit intowarproxxx:mainfrom
Hanqing:main

Conversation

@Hanqing
Copy link

@Hanqing Hanqing commented Feb 4, 2026

No description provided.

@Hanqing
Copy link
Author

Hanqing commented Feb 4, 2026

程序在处理“粘性时间戳”(Sticky Timestamp)逻辑时存在一个 退出条件判断错误 。

  1. 现象 :
    • Batch 1 抓满了 1000 条,最后一秒(2025-10-07 16:44:04)还有数据没抓完,所以程序进入了 STICKY 模式( sticky_timestamp 被设置)。
    • Batch 2 专门抓取该秒剩余的 4 条数据。抓取完成后,程序将 sticky_timestamp 重置为 None ,准备在下一轮继续正常抓取。
    • 错误点 :在 Batch 2 循环的最后,退出检查逻辑是:
      if len(df) < at_once and sticky_timestamp is None:
          break
      ``` 由于 Batch 2 只有 4 条(小于 1000),且 sticky_timestamp 刚刚被重置为 None ,这个条件意外成立,导致程序 误以为所有数据都抓完了 ,从而提前退出。
      

修复方案

我们需要区分“刚刚结束 STICKY 模式”和“一直是非 STICKY 模式”。

  • 如果本轮查询是 STICKY 模式(为了补全某一秒的数据),即使数据不满 1000 条,也 不应该退出 ,而应该继续查询下一秒的数据。
  • 只有在 非 STICKY 模式 (正常向后查询)下返回不满 1000 条,才说明真正到达了数据末尾。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant