I wrote a blog post in my other personal blog about how to create a machine that will manage it’s own lifecycle.
I work a lot with background workers, and I constantly need a better way to manage my Resque worker machines, so I wrote a post about how I did it.
I booted up over 50 servers with about 600 Resque workers using this method, and all with a click of a button in the UI.
Worth your time to read it if you are using Resque/Sidekiq and you need to add workers on rush-times of your site or something.
Creating self starting worker machines for fun and profit – Avi Tzurel.
If you are running a consultancy business, or even thinking about it, this post is a must read for you.
The comments are sometimes even more interesting then the post itself, some very interesting discussions were ignited by this post.
Lessons Learned: The First Six Months of Running a Software Consultancy.
We have been tweaking the GC for the Gogobot website, the affects it has are simply mind blowing.
Since I am clearly not happy with the test suite time that we currently have, This seems like a nice solution and I am definitely gonna try it.
RSpec speed-up (24.6%) by tweaking ruby garbage collection – Ariejan.net.
Right now, I am working on an engine for the Gogobot application.
As part of my work on the engine, I am working with the Mongoid gem and the Fabrication gem, both great gems b.t.w.
The problem with Fabrication is that it wasn’t really adapted to working with Engines and it was relying a lot on Rails.root for where to locate the fabricator files.
Since in an engine, the application is located in spec/dummy I needed a better way locate the fabricators.
ok… so far the story of how I got to even writing this post.
To solve my problem I needed to grab all of the engines that are included inside the Rails application.
Turns out, there’s a real easy way to do it.
You can look at my solution including this line in the pull request I have open for Fabrication here:
Earlier today, I release version 1.3 of
The release includes:
Support for a custom finder class from the args_to_resque method (more details in the README
Bug fixes for the args that are being passed around
As always, issues and pull requests are welcome.
Last night, I released the 1.0 version of
Now or later?
The gem is being used in production for over 6 months now, in a big-scale website (
Gogobot), so I thought it’s time to put in some extra needed work, some major refactoring and to release 1.0. What’s new?
1.0 is basically the same in the core functionality, I refactored big bits of the codebase, it’s much cleaner and more readable then before (still need to work quite a bit on code documentation)
later method support for ActiveRecord models. Added the loner support, now you can mark methods to be loners, meaning only a single instance of this method can exist in the queue at all times, this is super useful when a user does many actions that will result in say a cache clear for the user, there’s no reason to do a clear more then once. (and there are many more cases like this)
So, right off the README, here’s simple usage for this gem
So, now you can do this:
The best thing about perform_later (not new in this version) is that you can pass in any param, and it will get translated into JSON with no problem.
You can pass in AR objects, hashes, arrays, anything you need, there’s no need to rewrite your methods.
I would love your comments, feel free to contribute issues, pull requests, documentation or anything else.
I am singing this song for something like 3 years now.
Estimations, fixed price projects and estimation ahead are all a scam.
You lose, the client loses, not a good situation.
A nice writeup on the Hashrocket blog.
Front loaded estimation is selling your stakeholder a lie – The Hashrocket Blog.
This is a must watch if you are doing Rails and doing TDD, it’s an eye opener on how you should really approach testing Rails apps the “Right” way.
I host almost 100% of my open source projects on Heroku, it’s amazing how easy it is to setup and how “out-of-your-way” they are.
Today, while working on one of my open source project I encountered this error:
It was right after I deployed and migrated the database.
After about 5 minutes of head scratching I came across
an answer on stackoverflow saying you have to restart your app after a migration for it to pick up on schema changes.
Had a DAH! moment there
I have been using a really useful snippet for a while now.
While dropping it today into a project I realized just how powerful it is:
it’s a drop-in and will work on any project
it’s database agnostic
it’s dead simple
it’s not sensitive to enum changes
and more and more
Just as an into, an enum is a way to have string represented as integers in your database.
Because integers are much faster to index and query (at least on mysql).
MySQL has an enum solution but ActiveRecord can’t really use it without some nasty hacking and it’s really messy when you want to add another param.
Enough Said, here’s the snippet
This gives you the ability to work with the Account model like so:
As you can see, it’s being persisted into the database as an integer, but you work with symbols/strings which is much nicer and cleaner.