czwartek, 25 września 2014

Track memory leaks in rails application.

So this day has come - your production server gets out of memory and you didn't notice millions of requests. After quick investigation you see that your ruby processes are just too fat(300MB? 500MB? 900MB?). You may wonder that some of the requests causes memory leaks.

If you're using passenger the quick workaround (just to minimize effects for now) could be killing worker after it grows too much: PassengerMaxRequests

Still we don't know what caused that. You might try to search for long requests and assume that they the one but long response doesn't need to mean memory leak.
You can easily count the number of objects created during the request.

If you are using ruby 2.1 you can gather more detailed information:

środa, 27 sierpnia 2014

Playing with ember-leaflet and circle marker

Here are results of playing with ember-leaflet and awesome-markers. This is how you can use ember-leaflet to mark area on a map:

You can also add another layer with custom markers(awesome-markers):

To install this with ember-cli you need to:

wtorek, 19 sierpnia 2014

Ember.js testing focusOut

Quick note how to test focusOut in integration tests in ember.
I was writing signup form using easyForm with client side validations. Note that validations return a promise so we have async call. The feature was about displaying error when I leave field.
First I wrote this and it worked on local machine. But then on CI I started getting errors after running this again it occurs that it fails sometimes.

The solution was to invoke the blur even on element instead of going to another field.  Click helper is a async helper( but it's probably waiting only for click event, not the corresponding ones.