Skip to content

Commit e4d6e9f

Browse files
committed
adjust logging levels, fix to get_seen_shortcodes
1 parent b95692c commit e4d6e9f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

.github/workflows/update-events-data.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
schedule:
55
- cron: '0 13 * * *' # 8am EST (UTC-5)
66
workflow_dispatch:
7-
inputs:
87

98
jobs:
109
instagram_feed:

backend/scraping/instagram_feed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
load_dotenv()
3838

3939
CUTOFF_DAYS = 1
40-
MAX_CONCURRENT_TASKS = int(os.getenv("MAX_CONCURRENT_TASKS", "10"))
40+
MAX_CONCURRENT_TASKS = int(os.getenv("MAX_CONCURRENT_TASKS", "5"))
4141
APIFY_API_TOKEN = os.getenv("APIFY_API_TOKEN")
4242

4343

@@ -483,7 +483,7 @@ async def process_scraped_posts(posts_data, cutoff_date):
483483
logger.info(f"Starting post processing for {len(posts_data)} scraped posts.")
484484
logger.info(f"Concurrency limit set to {MAX_CONCURRENT_TASKS} tasks.")
485485

486-
seen_shortcodes = get_seen_shortcodes()
486+
seen_shortcodes = await sync_to_async(get_seen_shortcodes)()
487487

488488
semaphore = asyncio.Semaphore(MAX_CONCURRENT_TASKS)
489489
tasks = []

backend/scraping/logging_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def setup_logging():
2020
logging.getLogger("httpcore").setLevel(logging.WARNING)
2121
logging.getLogger("openai").setLevel(logging.WARNING)
2222
logging.getLogger("PIL").setLevel(logging.INFO)
23+
logging.getLogger("apify_client").setLevel(logging.WARNING)
2324

2425
fmt = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
2526
handlers = [
@@ -28,6 +29,7 @@ def setup_logging():
2829
]
2930
logging.basicConfig(level=logging.DEBUG, format=fmt, handlers=handlers)
3031
root_logger._wat2do_configured = True
32+
root_logger.propagate = False
3133

3234

3335
setup_logging()

backend/services/storage_service.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ def _download_image_from_url(self, image_url: str) -> bytes | None:
5858
try:
5959
response = requests.get(image_url, timeout=60)
6060
response.raise_for_status()
61-
6261
return response.content
63-
except Exception:
64-
logger.exception(f"Failed to download image from {image_url}")
62+
except Exception as e:
63+
logger.error(f"Failed to download image from {image_url}: {e}")
6564
return None
6665

6766
def upload_image_from_url(

0 commit comments

Comments
 (0)