<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hamzaabdellaoui on Medium]]></title>
        <description><![CDATA[Stories by Hamzaabdellaoui on Medium]]></description>
        <link>https://medium.com/@hamzaabdellaoui26648999?source=rss-8db3c7f8a746------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*w4jdJLIoO_Hol9Ga</url>
            <title>Stories by Hamzaabdellaoui on Medium</title>
            <link>https://medium.com/@hamzaabdellaoui26648999?source=rss-8db3c7f8a746------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 18:09:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hamzaabdellaoui26648999/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Taming Scheduled Jobs at Scale with Asynq]]></title>
            <link>https://medium.com/@hamzaabdellaoui26648999/taming-scheduled-jobs-at-scale-with-asynq-c6693ca05d4a?source=rss-8db3c7f8a746------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6693ca05d4a</guid>
            <category><![CDATA[cronjob-scheduler]]></category>
            <category><![CDATA[work-queue]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Hamzaabdellaoui]]></dc:creator>
            <pubDate>Mon, 19 May 2025 14:21:51 GMT</pubDate>
            <atom:updated>2025-05-19T14:21:51.633Z</atom:updated>
            <content:encoded><![CDATA[<h3>Taming Scheduled Jobs at Scale with Asynq</h3><p>In one of my recent Go projects, I hit a common but frustrating challenge: <strong>how to reliably process scheduled jobs and background tasks at scale</strong>.</p><p>Initially, I had a custom setup combining cron jobs and some ad-hoc work queues. It worked fine in early stages, but as the app grew, this system quickly became <strong>unreliable</strong>:</p><ul><li>Some jobs were missed or delayed.</li><li>Debugging failed tasks was painful.</li><li>Adding visibility into the job queue meant reinventing the wheel.</li><li>Cron jobs needed better error handling and retry logic.</li></ul><p>That’s when I started looking for a robust solution — and I discovered <a href="https://github.com/hibiken/asynq"><strong>Asynq</strong></a>.</p><h3>What is Asynq?</h3><p><strong>Asynq</strong> is a powerful background task queue for Go, built on top of Redis. It allows you to schedule jobs to run:</p><ul><li><strong>Immediately</strong> (enqueue)</li><li><strong>At a specific time</strong> (scheduled)</li><li><strong>On a recurring schedule</strong> (cron-style)</li></ul><p>It also offers built-in:</p><ul><li>Retry mechanisms</li><li>Dead-letter queues</li><li>Task prioritization</li><li>A beautiful web UI for monitoring tasks</li></ul><p>In short, Asynq gives you everything you’d expect from a modern background processing system.</p><h3>My Use Case</h3><p>In my app, I needed to:</p><ul><li>Send recurring emails every morning</li><li>Run hourly data cleanup jobs</li><li>Queue time-sensitive notifications from user actions</li><li>Handle failures gracefully and retry on errors</li></ul><p>Instead of writing and maintaining all of this logic myself, <strong>Asynq handled it out of the box</strong>.</p><p>Here’s a quick example of how easy it was to define a task:</p><pre>task := asynq.NewTask(&quot;email:send_welcome&quot;, payload)<br>info, err := client.Enqueue(task, asynq.ProcessIn(10*time.Minute))</pre><p>And for scheduled (cron-like) jobs:</p><pre>scheduler := asynq.NewScheduler(redisConnOpt, nil)<br>_, err := scheduler.Register(<br>&quot;@every 1h&quot;, <br>asynq.NewTask(&quot;cleanup:temp_files&quot;, nil)<br>)</pre><p>That’s it. No more crontab config files or inconsistent task runners.</p><h3>Observability Matters</h3><p>One of the things I loved most was the <strong>Asynqmon</strong> dashboard. It gave me real-time visibility into:</p><ul><li>Pending tasks</li><li>Retry counts</li><li>Task durations</li><li>Errors and stack traces</li></ul><p>This made debugging and optimizing tasks way easier compared to my old setup.</p><h3>Lessons Learned</h3><p>If you’re building with Go and need:</p><ul><li>Scheduled jobs (cron)</li><li>Delayed tasks</li><li>Reliable retries</li><li>A UI to manage background processing</li></ul><p>…<strong>Asynq is a game changer.</strong></p><p>It saved me time, simplified my codebase, and made task processing reliable — even as the system scaled.</p><h3>Final Thoughts</h3><p>Instead of fighting with cron expressions, custom queues, and retry logic — let your app focus on business logic and let <strong>Asynq handle the background work</strong>.</p><p>You can find it here: <a href="https://github.com/hibiken/asynq">github.com/hibiken/asynq</a></p><p>Let me know if you’re using Asynq or have another favorite work queue in Go!</p><p><strong>#Golang #Asynq #BackgroundJobs #TaskQueues #Redis #SoftwareEngineering #BackendDevelopment</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6693ca05d4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>