Fix polling to use 24-hour window instead of resume feature
- Polling now always collects posts from last 24 hours - Removes resume feature that created too-narrow time windows - Fixes issue where polls returned 0 posts due to minutes-wide ranges 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -145,15 +145,20 @@ class PollingService:
|
|||||||
Collect data from a source.
|
Collect data from a source.
|
||||||
Wraps the existing data_collection.py functionality.
|
Wraps the existing data_collection.py functionality.
|
||||||
"""
|
"""
|
||||||
from data_collection import ensure_directories, load_index, save_index, calculate_date_range, load_state, save_state
|
from data_collection import ensure_directories, load_index, save_index, load_state, save_state
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
# Setup directories and load state
|
# Setup directories and load state
|
||||||
dirs = ensure_directories(self.storage_dir)
|
dirs = ensure_directories(self.storage_dir)
|
||||||
index = load_index(self.storage_dir)
|
index = load_index(self.storage_dir)
|
||||||
state = load_state(self.storage_dir)
|
state = load_state(self.storage_dir)
|
||||||
|
|
||||||
# Calculate date range (collect last 1 day)
|
# Calculate date range - always use last 24 hours for polling
|
||||||
start_iso, end_iso = calculate_date_range(1, state)
|
# Don't use the resume feature as it can create too narrow windows
|
||||||
|
end_date = datetime.now()
|
||||||
|
start_date = end_date - timedelta(hours=24)
|
||||||
|
start_iso = start_date.isoformat()
|
||||||
|
end_iso = end_date.isoformat()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Call the existing collect_platform function
|
# Call the existing collect_platform function
|
||||||
|
|||||||
Reference in New Issue
Block a user