Andrei Kaleshka's Avatar

Andrei Kaleshka

@widefix.bsky.social

Top 3% software engineer by Toptal | WideFix Founder

9 Followers  |  31 Following  |  48 Posts  |  Joined: 14.03.2025  |  2.2844

Latest posts by widefix.bsky.social on Bluesky

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!

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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!

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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).

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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?

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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!

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Work in a coffee shop

Work in a coffee shop

My son training

My son training

Heroku run long-running command properly

Heroku run long-running command properly

What's the connection between Heroku, my son, a coffee shop, and productivity?

Once, I asked to send mass emails from Heroku via a script. How dare I connect to the console and run it there! First of all, I made a mistake in predicting the operation.

02.11.2025 08:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Post image

I'm excited to share that my open-source projects have passed ๐Ÿœ๐—บ ๐—ฑ๐—ผ๐˜„๐—ป๐—น๐—ผ๐—ฎ๐—ฑ๐˜€! It's amazing to see how far they've reached and how they're helping others in the ๐—ฅ๐˜‚๐—ฏ๐˜† ๐—ฐ๐—ผ๐—บ๐—บ๐˜‚๐—ป๐—ถ๐˜๐˜†. I'm really grateful to everyone who has ๐˜€๐˜‚๐—ฝ๐—ฝ๐—ผ๐—ฟ๐˜๐—ฒ๐—ฑ, ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ๐—ฑ, or ๐˜€๐—ต๐—ฎ๐—ฟ๐—ฒ๐—ฑ ๐—ณ๐—ฒ๐—ฒ๐—ฑ๐—ฏ๐—ฎ๐—ฐ๐—ธ along the way. rubygems.org/profiles/ka8...

20.10.2025 17:14 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
Need advice on Solid Queue's memory usage ยท Issue #330 ยท rails/solid_queue Ruby: 3.3.4 Rails: 7.2.1 Solid Queue: 0.7.0, 0.8.2 I run a Rails App on AWS EC2 instance with 1G of memory. I notice the solid queue process takes up 15-20% of the instance's memory, which becomes ...

SolidQueue, the default ActiveJob's adapter in Rails, is very cool. But there is a catch - it needs 1Gb RAM to make all things out of the box working fine. That means it's not good for Heroku default Dynos. Surprise - github.com/rails/solid_...

#rails #solidqueue #activejob #heroku

10.10.2025 00:13 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

This simple and swift measure results in annual savings of $600!

07.10.2025 19:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

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.

07.10.2025 19:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

07.10.2025 19:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

07.10.2025 19:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

07.10.2025 19:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Heroku price with orphan add-on

Heroku price with orphan add-on

Heroku price without orphan add-on

Heroku price without orphan add-on

๐—ข๐—ป๐—ฒ ๐˜€๐—ถ๐—บ๐—ฝ๐—น๐—ฒ ๐˜„๐—ฎ๐˜† ๐˜๐—ผ ๐—ฐ๐˜‚๐˜ ๐—ฐ๐—ผ๐˜€๐˜๐˜€ ๐—ผ๐—ป #๐—›๐—ฒ๐—ฟ๐—ผ๐—ธ๐˜‚ ๐—ถ๐—ป๐˜€๐˜๐—ฎ๐—ป๐˜๐—น๐˜†
Heroku, a popular hosting provider for many businesses, particularly startups and small enterprises, offers convenience, easy setup, and reliability. However, it can be ๐—ฐ๐—ผ๐˜€๐˜๐—น๐˜†!

07.10.2025 19:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

๐Ÿ’ก 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.

02.10.2025 20:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

๐Ÿ‘‰ 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.

02.10.2025 20:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

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.

02.10.2025 20:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Not slow Ruby demo.

Not slow Ruby demo.

๐Ÿš€ ๐—ฅ๐˜‚๐—ฏ๐˜† ๐—ถ๐˜€ ๐—ป๐—ผ๐˜ ๐˜€๐—น๐—ผ๐˜„.
Itโ€™s all about ๐™๐™ค๐™ฌ ๐™ฎ๐™ค๐™ช ๐™˜๐™ค๐™ค๐™  ๐™ž๐™ฉ.
Many developers love to critique #ruby for being "๐˜ต๐˜ฐ๐˜ฐ ๐˜ด๐˜ญ๐˜ฐ๐˜ธ". But in most cases, the real bottleneck isnโ€™t Ruby at allโ€”it's the ๐——๐—•. HอŸeอŸrอŸeอŸโ€™อŸsอŸ อŸaอŸ อŸrอŸeอŸaอŸlอŸ-อŸwอŸoอŸrอŸlอŸdอŸ อŸeอŸxอŸaอŸmอŸpอŸlอŸeอŸ ๐Ÿ‘‡

02.10.2025 20:25 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Video thumbnail

Unforgettable days of learning, connections, and high energy. ๐Ÿ’Žโœจ
Forever grateful โ€” from the Heart of Code. โค๏ธ

#EuRuKo2025 #HeartOfCode

20.09.2025 22:25 โ€” ๐Ÿ‘ 9    ๐Ÿ” 4    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
ActualDbSchema - lightning talk Euruko 2025 Make your Rails development journey more productive and enjoyable with actual_db_schema. This is my lightning talk from Euruko 2025. - Download as a PDF or view online for free

My lightning talk at #euruko2025 about #actual_db_schema
Slides - www.slideshare.net/slideshow/ac...

19.09.2025 16:22 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
zapier-vs-self-made.md GitHub Gist: instantly share code, notes, and snippets.

Zapier vs DIY for event processing: pros, cons & cost analysis โ†’ gist.github.com/ka8725/242f4...

Do you agree with my scoring?

14.09.2025 19:33 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

Built a shiny new feature on OpenAIโ€™s API. By the time we released, it was deprecated. JavaScript vibes.

10.09.2025 16:05 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Life is choices: good or evil, comfort or suffering, solitude or community. This book shows the paths, which one you choose? ๐Ÿ’ฏ recommend it - The Glass Bead Game by Hermann Hesse

16.08.2025 12:12 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Targeted sales pitch by AI.

Targeted sales pitch by AI.

#AI is transforming sales at a frightening speed. Iโ€™ve never seen messages this targeted and direct from past "lead generators". Should I trust them? Still doubtful.

14.08.2025 21:18 โ€” ๐Ÿ‘ 1    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
On Aug 10, the N+1 issue was fixed.

On Aug 10, the N+1 issue was fixed.

With the N+1 we could not tame the RAM consumption.

With the N+1 we could not tame the RAM consumption.

The N+1 problem is not only about performance; it also impacts network traffic to the database, which can lead to unusual RAM usage.

Take care of your #rubyonrails app.

12.08.2025 17:42 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

@widefix is following 20 prominent accounts