Andrei Kaleshka
banner
widefix.bsky.social
Andrei Kaleshka
@widefix.bsky.social
Top 3% software engineer by Toptal | WideFix Founder
Moral: to be productive, utilize all the tools you have, and don't waste your hours waiting for feedback from long-running tasks. Don't waste precious time. In the end, only the result is important, not the time spent!
November 2, 2025 at 8:01 AM
And I achieve that with this little hack. Result is 100%, client is happy, my kid is picked up on time - he is happy (I hope so), my laptop can rest, it is happy too, I guess.
November 2, 2025 at 8:01 AM
I wrote a simple script, scheduled the task, closed my laptop, and picked up my kid from training on time. That's why I'm in the café now - waiting for him. But I don't want my limited time wasted. I want this time spent with 100% result.
November 2, 2025 at 8:01 AM
So what do I do? I have an answer today - just run a scheduled task via Heroku scheduler (devcenter.heroku.com/articles/sch...). Schedule it once a day and remove the schedule in a few hours when the script is stopped. That's it!
November 2, 2025 at 8:01 AM
I still had no idea how to run long-running processes without the risk of the connection dropping. I don't want to have these long-running processes on my laptop - I might want to close it, pack it into my backpack, and go home from this café where I am writing this message.
November 2, 2025 at 8:01 AM
While I learned from my mistakes in terms of keeping the processes and making the script idempotent (so that when I repeat it, the process continues from where it stops and does not perform the same actions twice).
November 2, 2025 at 8:01 AM
Nevertheless, I followed this way and it worked. Thanks god the users didn't need to receive the emails thrice!

That's a story from several years ago.

Today, I faced the same task.
November 2, 2025 at 8:01 AM
Well, naturally, we can split the job into several parts and run them one by one or in parallel. But still, having the scripts run via the Heroku console from a terminal is not an option, as the connection can drop on my side too.
November 2, 2025 at 8:01 AM
But that's not so bad to bombard users with the same (very useful, though!) email. The main challenge was still there - how do I run this script properly on Heroku if the connection drops in 1 hour, but I have an operation that takes more time?
November 2, 2025 at 8:01 AM
It turned out there were over 1 million users to whom I needed to send emails. So, in 1 hour, the connection dropped, and I had no idea where it stopped. Some users received emails, and some did not! Repeating the script again would send duplicate emails. What a fault!
November 2, 2025 at 8:01 AM
This simple and swift measure results in annual savings of $600!
October 7, 2025 at 7:25 PM
It's essential to remember to 𝗲𝗹𝗶𝗺𝗶𝗻𝗮𝘁𝗲 𝗮𝗻𝘆 𝗼𝗿𝗽𝗵𝗮𝗻𝗲𝗱 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 in your Heroku applications to avoid unnecessary costs. By taking prompt action to remove the orphaned 𝗣𝗼𝘀𝘁𝗴𝗿𝗲𝗦𝗤𝗟 add-on, as shown in the screenshot, expenses on hosting were reduced by $50 immediately, translating to a 15% savings.
October 7, 2025 at 7:25 PM
Unfortunately, the last step of removing the old add-on is often overlooked, leading to unnecessary expenses. While this oversight may not significantly impact established businesses, costing around $50 𝗽𝗲𝗿 𝗺𝗼𝗻𝘁𝗵, for startups without revenue, it can be a substantial burden.
October 7, 2025 at 7:25 PM
The process of upgrading the 𝗣𝗼𝘀𝘁𝗴𝗿𝗲𝗦𝗤𝗟 add-on involves several steps:
1. Create a new add-on, replicating the data from the main one;
2. Promote the new add-on to the primary status;
3. Eliminate the old add-on;
4. Remove the old add-on from the application.
October 7, 2025 at 7:25 PM
One common expense arises from the need to periodically upgrade resources, such as the PostgreSQL add-on. Read further to see how to avoid unnecessary costs.
October 7, 2025 at 7:25 PM
💡 T͟h͟e͟ ͟l͟e͟s͟s͟o͟n͟: before blaming 𝗥𝘂𝗯𝘆 (or any language), check your 𝗗𝗕 first. That’s usually where the real performance story lives.
October 2, 2025 at 8:25 PM
👉 The app only ever needed the last 30 days.
T͟h͟e͟ ͟f͟i͟x͟:
🔧 Simply rotate (delete) obsolete data on schedule. Result: an 𝗲𝗮𝘀𝘆, 𝗿𝗲𝗹𝗶𝗮𝗯𝗹𝗲, 𝗺𝗮𝗶𝗻𝘁𝗮𝗶𝗻𝗮𝗯𝗹𝗲, 𝗮𝗻𝗱 𝘀𝘂𝘀𝘁𝗮𝗶𝗻𝗮𝗯𝗹𝗲 solution — and a 𝗯𝗹𝗮𝘇𝗶𝗻𝗴 𝗳𝗮𝘀𝘁 app again.
October 2, 2025 at 8:25 PM
An app started running painfully slow. At first, everything was fine — until millions of records piled up over time. The culprit? Automatic stats collection from a 3rd-party service, dumping endless data into the DB.
T͟h͟e͟ ͟c͟a͟t͟c͟h͟:͟ 👉 90% of this data was useless.
October 2, 2025 at 8:25 PM