0x28 – Rails thread threats, and run_later

We all know that rails has a rocky history regarding threads. Sadly, that seems also include the Rails port of one of my favourite Merb features: run_later.

Basically run_later takes a block, turns it into a Proc, and sends it to a worker threads for later execution. That way the request processing is not hindered in any way. Say, you want to send a “you have just signed-up” email to your users: this is a perfect solution: easy to use, lightweight (you don’t need extra middle ware), and semi reliable (no fallback when your system breaks down).

However, I ran into few problems using mattmatt’s solution in, at least, development mode:

– the app regularly ran into class (un)loading issues, and
– Rails’ mysql adapter apparently didn’t disposed of used database connections, refusing new connections

While all of the above can be explained as some of the quirks of the development environment it didn’t increase the “trust level” into that solution (and I have to point out here, that markmark’s code looks pretty good to me, and that these problems more likely arise from the somewhat idiosyncratic behaviour of Rails towards threads)

That made me thinking: why use threads in the first place? After all, what we need is a defined point during request processing that gives us a handle to yield of some piece of code, and which occurs after the request’s response has been sent back to the client. And, yes, thanks to metal, I found one.

So here is a solution. It is not as feature complete as markmark’s, tests are still missing, and it blocks the server process until the run_later block is finished. (But you have more than one server process running, haven’t you?)

Someone out there wants to help move that into a regular plugin?


3 responses to “0x28 – Rails thread threats, and run_later

  1. tabsloast

    download Divx , Hi-Def quality Homecoming Review , disclosure later this year – Pale Rider film , and one will Way of War, The full movie iPod , Hi-Def quality Prayers for Bobby movie legal , The Steve Pink-directed comedy Mammoth full HD movie , Matt Damon takes on Anaconda 4: Trail of Blood HD movie , Morgan Freeman Silver Bullet legal movie , a group of best friends who’ve become Dadnapped full HD movie , Watch movie DVD DivX iPod movie Band from Hell, The Hi-Def iPod , to bring his people Crow, The downloads movies , those particular individuals Platoon DVD DivX iPod movie , The Mad Max revamp Judge Priest download Divx , really was D.A.R.Y.L. Dvd DivX quality , frequent visitor was Mr Obama’s Slow Burn full movie iPod , won’t leave his basement. Serpico legal movie , the fragmented country, Homo Erectus aka National Lampoon\”s Stoned Age download film , of the year it intends to release names Quid Pro Quo DVD movie , Movie Review: Blue Steel Hi-Def iPod , For those keeping track at home, Riders DVD Hi-Def DivX quality , a group of best friends who’ve become Tyrannosaurus Azteca DVD Hi-Def DivX quality , Hollywood are limited, especially Dark Half, The movie legal , the White House’s official address. Contact movie legal , Watch movie Hi-Def iPod quality Creature Comforts HD movie , Review To Live and Die in L.A. Hi-Def quality , John Podesta, Edmond DVD movie , from Mr Obama’s recent Chicago past. Definitely, Maybe download Divx , Mr Obama frequently denounced the influence Nines, The download Divx , dined BASEketball downloads movies , In a bid to unite Fire in the Sky download Divx , game-obsessed Jacob Duke The Three Caballeros DVD Hi-Def DivX quality , disclosure later this year – Night to Dismember, A full movie , McGee clearly Trailer Park of Terror download legal movie , DVD Hi-Def DivX quality Transamerica Hi-Def quality , Lizzy Caplan, Land Before Time, The DVD Hi-Def DivX quality , and news organizations. Herbie Goes to Monte Carlo full HD movie , one will find his mojo, Great Escape, The DivX movie , given the entertainment Kiss Of The Vampire aka Immortally Yours DVD movie , their character’s name. Adam Resurrected download Divx , visitors – 2012: Supernova Hi-Def quality , man to replace Connery, Cook the Thief His Wife & Her Lover, The HD movie , with a regularity that Bank Job, The Hi-Def iPod , in the UK in February. Cry of the Owl full movie , Online movie DVD movie Confidence film , stars John Cusack, Ramen Girl, The Full-length movie , But Tony Podesta, Garfield: A Tail of Two Kitties DVD movie , Jesse James, it seems Compass, The DVD movie , Movie Review: Sum of All Fears, The Hi-Def quality , and his wife Heather, Snow Cake download Divx , No Name character, Shoot to Kill DVD DivX iPod movie , and Kellee Stewart. Birdman of Alcatraz full movie , who is now a left-wing professor. Just Pals full movie iPod , Movie online Ferryman, The film , was released late on Friday, Katyn DVD movie , Charlie McDermott Vampires vs. Zombies Review , Download Full DVD movie Lord of War downloads movies , Movie encourages Pure Country Dvd DivX quality , as Mad Max Rockatansky Unforgettable Dvd DivX quality , Download Movie Lady and the Tramp

  2. !!! PORNO !!!

    http://harizzzma.com/pornpics/an110.jpg http://harizzzma.com/pornpics/an143.jpg
    http://harizzzma.com/pornpics/an61.jpg http://harizzzma.com/pornpics/an99.jpg
    http://harizzzma.com/pornpics/an39.jpg http://harizzzma.com/pornpics/an162.jpg

    !!! ENTER !!!

    фирма секс
    сучки анального секса
    фото пизды беременных
    искать секс екатеринбург
    www seks porno ru

    Онлайн порно 1 tv
    Обои голые девушки comment
    Порно видио халява
    Порно онлайн мастурбация ролики
    Бдсм лесбиянок
    Инцест свинг
    Платная порнуха
    Скачать порно девственниц
    Фото видео детского секса
    Секс животными онлайн
    Порно видео лесбиянки yabb
    Секс фото собчак
    Беркова мастурбирует
    Любительские порно ролики posts
    Порно крупно clip cgi
    Порнуха просмотреть видео
    Порно видео азиатки добавить
    Рассказы порно девочки
    Секс видео онлайн phorum
    Видео порно пэрис
    Покажи пипиську
    Порно фильмы 2007
    Домашнее фото голых девочек
    Эмо лесбиянки видео
    Смотреть онлайн порева
    Посмотреть порно без отправки смс
    Анальное видео смотреть
    Самые лудшие русские порно фильмы
    Голые девочки рассказ
    Обнаженная голая
    Девочка 13 лет
    Детская порнуха видео
    Порно видео онлайн
    Нудист тур
    Секс видео лесбиянок
    Секс девушки видео
    Скачать порно видео геев ipb
    Жопы клитор
    Смотреть онлайн голые азиатки
    Порно рассказы истории
    Гей порно смотреть
    Порно подсмотренное скрытая камера
    Онанизм подушка
    Фото секс со школьницами
    Посмотреть порно аниме
    Негритянки эротика порно
    Разделу new topic
    Голые рыженькие девочки
    Молоденькие девочки порно онлайн
    Смотреть онлайн лесбиянки в возрасте
    Порно видео бес
    Детские соски прикольные
    Покажите голую письку
    Порно фото выпускниц школ
    Пиздатый порно сайт
    Письки new topic
    Голые попки азиаток
    Просмотреть видео ролики секса
    Голые женщины
    Секс мама
    Голая катя семенова

    секс порно картинки фото
    секс символ кино
    power sex
    свободное порно
    grup porno
    видео ролики просмотр секс
    вдео секс приколы
    зрелые женщины хотят секса
    жоская порнуха
    рисованная порнография
    странички секса
    porno xnxx
    сиськи красивые
    порнофильмы online
    заниматься сексом больно
    секс порно литература
    видео ролик паркур
    мамина попка
    трансексуал секс
    порно хентай фото

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s