<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Alex5205 Engineering]]></title><description><![CDATA[Alex5205 Engineering]]></description><link>https://alex5205.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 19:36:41 GMT</lastBuildDate><atom:link href="https://alex5205.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I Built an Autonomous AI News Aggregator for Telegram in ~100 Lines of Python ($5/mo Setup)]]></title><description><![CDATA[Running a niche Telegram channel manually takes 1–2 hours every single day: scanning dozens of RSS feeds, filtering out clickbait, rewriting dry press…]]></description><link>https://alex5205.hashnode.dev/how-i-built-an-autonomous-ai-news-aggregator-for-telegram-in-100-lines-of-python-5-mo-setup</link><guid isPermaLink="true">https://alex5205.hashnode.dev/how-i-built-an-autonomous-ai-news-aggregator-for-telegram-in-100-lines-of-python-5-mo-setup</guid><category><![CDATA[Python]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[telegram bot]]></category><category><![CDATA[automation]]></category><category><![CDATA[openai]]></category><dc:creator><![CDATA[Alex5205]]></dc:creator><pubDate>Thu, 03 Dec 2026 15:47:40 GMT</pubDate><content:encoded><![CDATA[<p>Running a niche Telegram channel manually takes 1–2 hours every single day: scanning dozens of RSS feeds, filtering out clickbait, rewriting dry press releases into readable posts, and formatting HTML tags without breaking Telegram's parser. I wanted a fully autonomous pipeline that runs 24/7 on a cheap $5/mo Ubuntu VPS, costs pennies in LLM tokens, and never posts duplicate stories or crashes on malformed HTML. Here is the architecture behind my Python + aiogram 3 + GPT-4o-mini news aggregator.</p>
<ol>
<li>The Pipeline Architecture</li>
</ol>
<p>Instead of heavy frameworks or complex message brokers, the entire worker runs as a lightweight systemd daemon polling feeds on a schedule: • RSS Ingestion (feedparser): Fetches entries from curated tech/AI RSS sources with clean timeout handling so one dead feed never blocks the loop. • SQLite Deduplication (posted_news.db): Stores normalized URLs and content hashes locally before hitting any paid LLM API—saving 100% of token costs on already-processed items. • LLM Summarization (gpt-4o-mini): Rewrites raw articles into concise, engaging Telegram posts with structured takeaways and source attribution. • Strict HTML Sanitizer: Telegram's Bot API rejects an entire message if a single</p>
<p>,<br />, or unclosed <strong>tag slips through. A dedicated sanitizer strips unsupported tags and balances open entities before delivery.</strong></p>
<ol start="2">
<li><strong>Production Reliability on a $5/mo VPS</strong></li>
</ol>
<p><strong>To make sure the bot survives network hiccups and server reboots without manual intervention: • Systemd Service (Restart=always): Automatically restarts the worker within 10 seconds if an upstream API times out. • Environment Isolation (.env): Keeps bot tokens, OpenAI/compatible API keys, channel IDs, and polling intervals cleanly separated from application code.</strong></p>
<p><strong>Public Demo &amp; Full Production Kit</strong></p>
<p><strong>You can inspect the pipeline diagram, .env configuration example, deduplication logic, and HTML sanitizer overview in the public GitHub demo: • GitHub Public Demo:</strong> <a href="http://github.com"><strong>github.com</strong></a> <strong>If you want the complete ready-to-deploy codebase (</strong><a href="http://poster.py"><strong>poster.py</strong></a><strong>, requirements.txt, .env.example, and a step-by-step Ubuntu VPS + systemd deployment guide), you can download the full kit here: • Get the Full Kit on Boosty (EN): https://</strong><a href="http://boosty.to/neuropulse_dev/posts/79e5a735-918b-47ae-828c-3cdc3595582d"><strong>boosty.to/neuropulse_dev/posts/79e5a735-918b-47ae-828c-3cdc3595582d</strong></a> <strong>• International Mirror (Lava.top): lava.top</strong></p>
]]></content:encoded></item><item><title><![CDATA[How to Ace a Spring Boot Take-Home Assignment: Solving Race Conditions & Writing a True Multithreaded Test]]></title><description><![CDATA[Most backend take-home assignments fail in code review for one reason: they work fine for a single user, but break immediately when 20 requests hit the…]]></description><link>https://alex5205.hashnode.dev/how-to-ace-a-spring-boot-take-home-assignment-solving-race-conditions-writing-a-true-multithreaded-test</link><guid isPermaLink="true">https://alex5205.hashnode.dev/how-to-ace-a-spring-boot-take-home-assignment-solving-race-conditions-writing-a-true-multithreaded-test</guid><category><![CDATA[Java]]></category><category><![CDATA[spring-boot]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[Backend Development]]></category><dc:creator><![CDATA[Alex5205]]></dc:creator><pubDate>Thu, 03 Dec 2026 15:42:34 GMT</pubDate><content:encoded><![CDATA[<p>Most backend take-home assignments fail in code review for one reason: they work fine for a single user, but break immediately when 20 requests hit the same endpoint at the exact same millisecond. When two users try to book the last available seat at the exact same time, a standard findById() followed by save() creates a classic race condition—resulting in double-bookings and corrupted database state. Here is how to build a 3-layer defense against concurrency bugs in Spring Boot 3.5 + PostgreSQL 16, and how to prove it works using a real multithreaded JUnit 5 test.</p>
<ol>
<li>The 3-Layer Concurrency Defense</li>
</ol>
<p>To handle race conditions properly at scale, delegate concurrency management to the database layer rather than relying on Java's synchronized keyword: • Layer 1 — Pessimistic Locking (PESSIMISTIC_WRITE): Use @Transactional with exclusive row-level locking (SELECT ... FOR UPDATE) so concurrent requests wait in line. • Layer 2 — Database Schema Constraints (Flyway): Add strict constraints like CHECK (available_seats &gt;= 0) in PostgreSQL to prevent invalid states. • Layer 3 — Automated Expiration Cleanup (@Scheduled): Clean up reserved-but-unpaid seats via scheduled background tasks.</p>
<ol start="2">
<li>Writing a True Multithreaded Test (CountDownLatch)</li>
</ol>
<p>To verify that the system handles high contention without data corruption, test the endpoint by firing 20 simultaneous threads using ExecutorService and CountDownLatch to simulate a spike of requests. Under proper locking, only the allocated number of seats will be reserved, and excess requests will gracefully return 409 CONFLICT.</p>
<p>Full Reference Repository &amp; Interview Cheatsheet</p>
<p>• GitHub Public Demo: <a href="https://github.com/Alex5205/spring-boot-race-condition-booking-demo">https://github.com/Alex5205/spring-boot-race-condition-booking-demo</a> • Get the Full Kit on Boosty (EN): <a href="https://boosty.to/neuropulse_dev/posts/652016c7-5b68-41e0-9df2-d4991bd9f412">https://boosty.to/neuropulse_dev/posts/652016c7-5b68-41e0-9df2-d4991bd9f412</a> • International Mirror (Lava.top): <a href="https://app.lava.top/products/c43bc87c-59b7-419d-9d3a-2f7000484d0d">https://app.lava.top/products/c43bc87c-59b7-419d-9d3a-2f7000484d0d</a></p>
]]></content:encoded></item></channel></rss>